Matrix addition by using Array in C
#include<stdio.h>
#include<conio.h>
int main()
{
int arr1[2][2],arr2[2][2],i,j;
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("Enter the Elements : ");
scanf("%d",&arr1[i][j]);
}
}
printf("\n Next Matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\nEnter the Elements : ");
scanf("%d",&arr2[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",arr1[i][j]+arr2[i][j]);
}
printf("\n");
}
return 0;
}
0 Comments