/* Matrix Sum and Difference - Program to find sum and difference of two matrices */ #include #include void read(int x[ ][10], int nr, int nc) ; void sumdiff(int a[ ][10], int b[ ][10], int s[ ][10], int d[ ][10], int nr, int nc) ; void show(int y[ ][10], int nr, int nc) ; void main() { int a[10][10], b[10][10], s[10][10], d[10][10], nra, nca, nrb, ncb ; clrscr(); printf("Enter the number of rows and columns of first matrix: "); scanf("%d %d", &nra, &nca) ; printf("Enter the number of rows and columns of second matrix: "); scanf("%d %d", &nrb, &ncb) ; if(nra==nrb && nca==ncb) { printf("Enter elements of first matrix row-wise: \n") ; read(a,nra,nca) ; printf("Enter elements of second matrix row-wise: \n") ; read(b,nrb,ncb) ; sumdiff(a,b,s,d,nra,nca); printf("Result of matrix addition is: \n") ; show(s,nra,nca) ; printf("Result of matrix subtraction is: \n") ; show(d,nra,nca) ; } else printf("Matrix addition and subtraction not possible."); getch(); } void read(int x[ ][10], int nr, int nc) { int r, c ; for(r=0 ; r