//Write a program to find the sum of two matrix.
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
int main()
{
int arr1[5][5],arr2[5][5],arr3[5][5],i,j,avg,sum=0;
puts("Enter 1st Matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&arr1[i][j]);
}
}
puts("Enter 2nd Matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&arr2[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
arr3[i][j]=arr1[i][j]+arr2[i][j];
}
}
printf("After Matrix Addition\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t",arr3[i][j]);
}
printf("\n\n");
}
/*printf("%d",sum);
printf("avg is = %d",sum/2);*/
return 0;
}
OUTPUT
0 Comments:
Post a Comment