How to Sum of two matrices in c language programming

 Program to find the Sum of two matrices using c language programming

#include<stdio.h>
#include<conio.h>
main()
{
int x,y,m,n,i,j;
int a[10][10],b[10][10],c[10][10];
printf("Enter the Row & Colum of Matrice A or B\n");
scanf("%d%d",&m,&n);
printf("\n\Enter Element of Matrice A\n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<m;i++)
{
printf("\n\n");
for(j=0;j<n;j++)
{
printf("%d\t",a[i][j]);
}
}
printf("\n\nEnter Element of Matrice B\n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<m;i++)
{
printf("\n\n");
for(j=0;j<n;j++)
{
printf("%d\t",b[i][j]);
}
}
printf("\n\n Sum of Two Matrices\n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<m;i++)
{
printf("\n\n");
for(j=0;j<n;j++)
{
printf("%d\t",c[i][j]);
}
}
getch();
}

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form