#include <stdio.h>
int main()
{
int a[5][5],i,j,m,n,b[5][5],res[5][5];
printf("enter the order of matrix m,n\n");
scanf("%d%d",&m,&n);
printf("enter the elements of array A\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
scanf("%d",&a[i][j]);
}
printf("enter the elements of array B\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
scanf("%d",&b[i][j]);
}
printf("elements of 2d array are\n");
for(i=1;i<=m;i++)
printf("enter the elements 2d array\n");
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
res[i][j]=0;
res[i][j]=a[i][j]+b[i][j];
}
}
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
printf("%d\t",res[i][j]);
}
printf("\n");
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: