C Program to find Sum of Matrices
Program :-
#include <stdio.h>
void main()
{
int r,c,i,j,first[10][10],second[10][10],sum[10][10];
printf("\nSum Of Matrices");
printf("\n-----------------------");
printf("\nEnter the number of rows : ");
scanf("%d",&r);
printf("\nEnter the number of coloumns : ");
scanf("%d",&c);
printf("\n Enter the elements of first Array : ");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&first[i][j]);
}
}
printf("\n Enter the elements of second Array : ");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&second[i][j]);
}
}
printf("\nSum of enterd matrices : \n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
sum[i][j]=first[i][j]+second[i][j];
printf("%d\t",sum[i][j]);
}
printf("\n");
}
}
Output
For video classes : Prastheena Learning Class
Comments