#include<stdio.h>

#include<conio.h>

int main()

{

int m, n, c, d, a[10][10], b[10][10], e[10][10];

clrscr();

printf(“Enter the number of rows and columns of matrix\n”);

scanf(“%d%d”, &m, &n);

printf(“Enter the elements of first matrix\n”);

for (c = 0; c < m; c++)

for (d = 0 ; d < n; d++)

scanf(“%d”, &a[c][d]);

printf(“Enter the elements of second matrix\n”);

for (c = 0; c < m; c++)

for (d = 0; d < n; d++)

scanf(“%d”, &b[c][d]);

printf(“Difference of entered matrices:-\n”);

for (c = 0; c < m; c++)

{

for (d = 0; d < n; d++)

{

e[c][d] = a[c][d] – b[c][d];

printf(“%d\t”,e[c][d]);

}

printf(“\n”);

}

getch();

return(0);

}

Output :-

Advertisements