#include <stdio.h>
int main()
{
int a[20][20], b[20][20],r,c,i,j;
printf("Enter the rows: ");
scanf("%d", &r);
printf("Enter the col: ");
scanf("%d", &c);
printf("Enter the value of matrix A: ");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("Enter the value of a[%d][%d] ",i,j);
scanf("%d", &a[i][j]);
}
}
printf("Enter the value of matrix B: ");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("Enter the value of a[%d][%d] ",i,j);
scanf("%d", &b[i][j]);
}
}
printf("\n Total matrix \n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("\t %d", (a[i][j])+b[i][j]);
}
printf("\n");
}
return 0;
}
Comments
Post a Comment