-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMOH5.C
39 lines (37 loc) · 806 Bytes
/
MOH5.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
void main()
{
float mat1[10][10],mat2[10][10],mat3[10][10];
static int r,c,i,j;
clrscr();
printf("\n\n\n\tENTER THE NUMBER OF ROWS OF THE MATRIX : ");
scanf("%d",&r);
printf("\n\tENTER THE NUMBER OF COLOUMNS OF THE MATRIX : ");
scanf("%d",&c);
printf("\n\tenter the elememts of the matrix : ");
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
scanf("%f",&mat1[i][j]);
}
printf("\n\tenter the elememts of the matrix : ");
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
scanf("%f",&mat2[i][j]);
}
for(i=0;i<r;i++)
for(j=0;j<c;j++)
{
*(*(mat3 +i)+j)=*(*(mat1 +i)+j)+*(*(mat2 +i)+j);
}
printf("the sum of the matrices are :\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("%8.2f",mat1[i][j]);
}
printf("\n");
}
}