Advertisement
Guest User

subtraction between the two matrix

a guest
Dec 8th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int row, column, i, j;
  6. int A[10][10], B[10][10], res[10][10];
  7.  
  8.  
  9. printf("Enter the element of first matrix\n");
  10.  
  11. for (i = 0; i < 4; i++)
  12. {
  13. for (j = 0; j < 4; j++)
  14. {
  15. scanf("%d", &A[i][j]);
  16. }
  17. }
  18.  
  19. printf("Enter the element of the second matrix\n");
  20.  
  21. for (i = 0; i < 4; i++)
  22. for (j = 0; j < 4; j++)
  23. scanf("%d", &B[i][j]);
  24.  
  25. printf("The difference between the matrix A-B\n");
  26.  
  27. for (i = 0; i < 4; i++)
  28. {
  29. for (j = 0; j < 4; j++)
  30. {
  31. res[i][j] =A[i][j] -B[i][j];
  32.  
  33. printf("Therefore the resultant matrix after the subtraction of the 4x4 matrix is %d\t",res[i][j]);
  34. }
  35. printf("\n");
  36. }
  37.  
  38. return 0;
  39. }
  40.  
  41. //Happy Coding
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement