void main()
{
int A[5][5], B[5][5], C[5][5], i, j, m, n;
clrscr();
printf(“nnt ENTER A ORDER OF THE MATRICES M,N…: “);
scanf(“%d,%d”, &m, &n);
printf(“nnt ENTER THE ELEMENTS OF THE FIRST MATRIX..:nn”);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
gotoxy(25+j*4,12+i*2);
scanf(“%d”,&A[i][j]);
}
printf(“n”);
}
printf(“nt ENTER THE ELEMENTS OF THE SECOND MATRIX..:nn”);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
gotoxy(25+j*4,18+m+i*2);
scanf(“%d”,&B[i][j]);
}
printf(“n”);
}
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
C[i][j] = A[i][j] – B[i][j];
printf(“nt THE DIFFERENCE OF TWO MATRICES IS…:nnttt “);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
printf(” %d”,C[i][j]);
printf(“nnttt “);
}
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C Program To multiply two Matrices
- C program to accept two matrices and find the sum and difference of the matrices
- C Program to accept two matrices and check if they are equal
- C program to read two matrices A (MxN) and B(MxN) and perform addition OR subtraction of A and B. Find the trace of the resultant matrix. Output the given matrix, their sum or Differences and the trace.
- C Program – Find the transpose of a Matrix
