Martices Addition
/* Program to the addition of 2 matrices */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a[2][2],b[2][2],sum[2][2];
printf("\n Enter the elements of first matrix : \n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j);
}
}
printf("\ Enter the elements of second matrix:\n ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanff("%d",&b[i][j]);
}
}
/* Logic Starts Here */
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
sum[i][j]=a[i][j]+b[i][j];
}
}
printf("\n the sum of matrices........\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
{
p[rintf("%d",sum[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d",sum[i][j];
}
printf("\n");
}
}