Here you will discover a program for grid expansion in C.
Two grid can be included just when a number of lines and sections of the first lattice is equivalent to the number of lines of segments of the second framework.
Matrix Addition in C
#include<stdio.h>
int main()
{
int a[5][5],b[5][5],c[5][5],i,j,m,n;
printf("How many rows and columns?");
scanf("%d%d",&m,&n);
printf("\nEnter first matrix:\n");
for(i=0;i<m;++i)
for(j=0;j<n;++j)
scanf("%d",&a[i][j]);
printf("\nEnter second matrix:\n");
for(i=0;i<m;++i)
for(j=0;j<n;++j)
scanf("%d",&b[i][j]);
printf("\nMatrix after addition:\n");
for(i=0;i<m;++i)
{
for(j=0;j<n;++j)
{
c[i][j]=a[i][j]+b[i][j];
printf("%d ",c[i][j]);
}
printf("\n");
}
return 0;
}
Output
How many rows and columns?3
3
Enter first matrix:
2 6 9
3 2 0
2 4 1
Enter second matrix:
3 4 1
6 7 9
11 3 5
Matrix after addition:
5 10 10
9 9 9
13 7 6