0

```
/* MATRIX ADDITION */
#include<stdio.h>
#include<conio.h>
#define MAX 100
struct Matrix
{
int Element[MAX][MAX];
int No_of_Rows;
int No_of_Cols;
};
void MatrixAdd(const struct Matrix *,const struct Matrix *,struct Matrix *);
int i,j;
void main()
{
int p,q;
struct Matrix Mat1;
struct Matrix Mat2;
struct Matrix res;
clrscr();
printf("\nEnter size of the Matrix : ");
scanf("%d%d",&p,&q);
Mat1.No_of_Rows=Mat2.No_of_Rows=res.No_of_Rows=p;
Mat1.No_of_Cols=Mat2.No_of_Cols=res.No_of_Cols=q;
printf("\nEnter Matrix 1\n");
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
{
scanf("%d",&Mat1.Element[i][j]);
printf(" ");
}
printf("\n");
}
printf("\nEnter Matrix 2\n");
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
{
scanf("%d",&Mat2.Element[i][j]);
printf(" ");
}
printf("\n");
}
MatrixAdd(&Mat1,&Mat2,&res);
getch();
}
void MatrixAdd( const Matrix *a,const Matrix *b,Matrix *sum )
{
for(i=0;i<a->No_of_Rows;i++)
{
for(j=0;j<a->No_of_Cols;j++)
{
sum[i][j] = a->Element[i][j] + b->Element[i][j];
printf("%d ",sum[i][j]);
}
printf("\n");
}
}
```