Answer to Question #197763 in C for Prasanna

Question #197763

C programming , 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-24T04:13:31-0400
#include<stdio.h>
int main(){
  int a[50][50], b[50][50], c[50][50],i,j,m;
  printf("enter size of matrix");
  scanf("%d",&m);
  printf("enter first matrix");
  for(i=0;i<m;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  printf("enter second matrix");
  for(i=0;i<m;i++){
    for(j=0;j<m;j++){
      scanf("%d",&b[i][j]);
    }
  }
  printf("Subtraction of theese matrix is ");
  for(i=0;i<m;i++){
    for(j=0;j<m;j++){
      c[i][j]=a[i][j]-b[i][j];
    }
  }
  for(i=0;i<m;i++){
    printf("\n");
    for(j=0;j<m;j++){
      printf("%d\t",c[i][j]);
   }
  }
  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