Enter elements of 4×4 matrix and find sum of the elements of matrix in C program

//enter elements of 4×4 matrix and find sum
#include<stdio.h>
#include<conio.h>
main()
{
int a[4][4],b[4][4],sum[4][4],i,j;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("input the elemebt of matrix a:");
scanf("%d",&a[i][j]);

}
}
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("input the elemebt of matrix b:");
scanf("%d",&b[i][j]);
}
}
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
sum[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("%d\t",sum[i][j]);
}
printf("\n");
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image