Answer to Question #197772 in C for Prasanna

Question #197772

Let A and B be the two matrix. The size of matrix A is m and size of matrix B. Then, find subtraction of C, is a A and B is defined as C(ij) = A(ij) - B(ij).


1
Expert's answer
2021-05-25T23:12:12-0400
#include <stdio.h>

  
int main()  
{  
  int i, j,r,cl, A[10][10], B[10][10], C[10][10];  
  printf("Enter the number of rows and columns of matrix\n");  
  scanf("%d%d", & i, & j);  
  printf("Enter the elements of matrix A\n");  
  for (r = 0; r < i; r++){
    for (cl = 0; cl < j; cl++){
      scanf("%d", & A[r][cl]);
    }
  }  
      
  printf("Enter the elements of matrix B\n");  
   
  for (r = 0; r < i; r++) {
    for (cl = 0; cl <j; cl++){
      scanf("%d", & B[r][cl]); 
    }
  } 
      
  printf("Difference of entered matrices:\n"); 
   
  for (r = 0; r < i; r++)  
  {  
    for (cl = 0; cl < j; cl++)  
    {  
      C[r][cl] = A[r][cl] - B[r][cl];  
      printf("%d\t", C[r][cl]);  
    }  
    printf("\n");  
  }  
  return 0;  
} 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS