#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int a[n][m],b[n][m],c[n][m];
int i,j;
clrscr();
printf("\n enter the values of n and m");
scanf("\n %d%d",&n,&m);
printf("\n enter the element of matrix a");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf("\n %d",a[i][j]);
}
}
printf("\n enter the values of matrix b");
{
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf(\n %d",b[i][j]);
}
}
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\n %d",c[i][j]);
}
}
return (0);
}
output:-
enter the values of n=2
enter the values of m=2
enter the element of matrix a[]={1,2,3,4}
enter the element of matrix b[]={1,2,3,4}
matrix c[]={2,4,6,8}