addition of two matrix using array
// addition of two matrix using array
#include<stdio.h>
int main()
{
int i,j,m,n,a[10][10],b[10][10],c[10][10],k;
printf("enter the row and column of the matrix:");
scanf("%d%d",&m,&n);
printf("enter the elemetnof the matrix A:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("enter the element of the matrix B:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&b[i][j]);
}
printf("for addition of two matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%5d",a[i][j]+b[i][j]);
printf("\n");
}
}
}
Comments
Post a Comment