write the program in c two matrix addition [4*4]
///program----///
// write the program in c two matrix addition [4*4]//
#include<stdio.h>
#include<conio.h>
int main()
{
int A[4][4],B[4][4],C[4][4],i,j;
for(i=0; i<4; i=i+1)
{
for(j=0; j<4; j=j+1)
{
scanf("%d",&A[i][j]);
}
}
for(i=0; i<4; i=i+1)
{
for(j=0; j<4; j=j+1)
{
scanf("%d",&B[i][j]);
}
}
for(i=0; i<4; i=i+1)
{
for(j=0; j<4; j=j+1)
{
C[i][j]=A[i][j]+B[i][j];
printf("%d\t",C[i][j]);
}
printf("\n");
}
getch();
return 0;
}
Output---
2 3 4 5
3 4 6 7
6 4 2 8
3 6 8 8
3 5 6 8
9 7 4 6
8 9 6 3
3 6 0 1
5 8 10 13
12 11 10 13
14 13 8 11
6 12 8 9
Comments
Post a Comment