fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5. int rA, cA, rB, cB, k;
  6.  
  7. int *kp = &k;
  8.  
  9. printf("Enter A (m x n): ");
  10. if(!scanf("%d%d", &rA, &cA)){
  11. printf("\nInvalid input.");
  12. return 1;
  13. }
  14. if(cA < 1 || rA < 1){
  15. printf("\nInvalid input.");
  16. return 1;
  17. }
  18.  
  19. printf("\nEnter A (n x p): ");
  20. if(!scanf("%d%d", &rB, &cB)){
  21. printf("\nInvalid input.");
  22. return 1;
  23. }
  24. if(cB < 1 || rB < 1){
  25. printf("\nInvalid input.");
  26. return 1;
  27. }
  28.  
  29. printf("\nEnter the value of k: ");
  30. if(!scanf("%d", &k)){
  31. printf("\nInvalid input.");
  32. return 1;
  33. }
  34. if(k < 1){
  35. printf("\nInvalid input.");
  36. return 1;
  37. }
  38.  
  39.  
  40.  
  41. int N = 1;
  42. while((N < rA) || (N < cA) || (N < rB) || (N < cB)){
  43. N *= 2;
  44. }
  45.  
  46. printf("\n %d %d %d", rA, cA, N);
  47. int *A, *B, *C;
  48. *A = (int*)malloc(sizeof(int)*N*N);
  49. *B = (int*)malloc(sizeof(int)*N*N);
  50. *C = (int*)malloc(sizeof(int)*rA*cB);
  51. if (A == NULL || B == NULL || C == NULL){
  52. printf("\nThe program can't get enough RAM.");
  53. return 1;
  54. }
  55. printf("SUCCESS!!!!!!11");
  56. return 0;
  57. }
Runtime error #stdin #stdout 0s 2304KB
stdin
1 1 1 1 1
stdout
Standard output is empty