# include <stdio.h>
# include <conio.h>
int main()
{
int a[10][10],b[10][10],c[10][10];
int i, j, row,col;
printf("Enter rows and & cols of matrix");
scanf ("%d%d",&row,&col);
printf("Enter elements of first matrix");
for (i=0;i<row;++i)
for (j=0;j<col;++j)
scanf ("%d",&a[i][j]);
printf("Enter elements of second matrix");
for (i=0;i<row;++i)
for (j=0;j<col;++j)
scanf ("%d",&b[i][j]);
// add two matrices
for (i=0;i<row;++i)
for (j=0;j<col;++j)
c[i][j]=a[i][j]+b[i][j];
printf ("sum of two matrix is\n");
for (i=0;i<row;++i)
{ for (j=0;j<col;++j)
printf ("%d\n",c[i][j]);
printf("\n");
}
getch();
return 0;
}
Enter rows and & cols of matrix
3
3
Enter elements of first matrix5
5
5
6
8
5
4
5
4
Enter elements of second matrix5
5
4
5
4
5
4
5
5
sum of two matrix is
10
10
9
11
12
10
8
10
9