PHP Code:
/* program to perform martix addition */
# include <stdio.h>
void main ()
{
int i,j;
int a[2][2],b[2][2],c[2][2];
printf("\nAddition of A & B martices");
printf("\n\n Enter elements of martix A");
for (i=0;i<=1;i++)
{
for (j=0;j<=1;j++)
{
scanf("%d",&a[i][j]);
}
}
Printf("\nEnter elements of matrix B");
for (i=0;i<=1;i++)
{
for (j=0;j<=1;j++)
{
scanf("%d",&b[i][j]);
}
}
for (i=0;i<=1;i++)
{
for (j=0;j<=1;j++)
c[i][j]=a[i][j]+b[i][j];
}
printf(" Addition matrix of %d and %d is %d",a[2][2],b[2][2],c[2][2]);
printf("\n");
}
I'm getting errors. can you help me out.
Its 2 x 2 matrix addition, where A and B 2D arrays are taken as inputs and C arrays is output ( addition matrix of A and B)