#include<stdio.h>
#include<conio.h>
int main()
{
int a[2][2]={{1,2},{3,4}};
int b[2][2]={{4,5},{6,7}};
int c[2][2]={{0},{0}};
int i=0,j=0;
for (i=0;i<2;i++)
{
for (j=0;j<2;j++)
printf("%d\t",a[i][j]);
printf("\n");
}
printf("\n");
for (i=0;i<2;i++)
{
for (j=0;j<2;j++)
printf("%d\t",b[i][j]);
printf("\n");
}
printf("\nthe sum of 2 matrices is\n ");
for (i=0;i<2;i++)
{
for (j=0;j<2;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("%d\t",c[i][j]);
}
printf("\n");
}
getch();
return 0;
}
No comments:
Post a Comment