-
Notifications
You must be signed in to change notification settings - Fork 16
/
15.c
54 lines (47 loc) · 1.21 KB
/
15.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
int main()
{
int siz, i, j;
printf("Enter Size of Square Matrix: ");
scanf("%d", &siz);
int matrixA[siz][siz], matrixB[siz][siz];
printf("\nEnter Values For Matrix A:\n");
for (i = 0; i < siz; i++)
{
for (j = 0; j < siz; j++)
{
printf("Position (%d, %d): ", i + 1, j + 1);
scanf("%d", &matrixA[i][j]);
}
}
printf("\nEnter Values For Matrix B:\n");
for (i = 0; i < siz; i++)
{
for (j = 0; j < siz; j++)
{
printf("Position (%d, %d): ", i + 1, j + 1);
scanf("%d", &matrixB[i][j]);
}
}
printf("\nSummation of Matrix A & Matrix B:\n");
for (i = 0; i < siz; i++)
{
printf("\t|");
for (j = 0; j < siz; j++)
{
printf("%6d", matrixA[i][j] + matrixB[i][j]);
}
printf("\t|\n");
}
printf("\nSubtraction of Matrix B from Matrix A:\n");
for (i = 0; i < siz; i++)
{
printf("\t|");
for (j = 0; j < siz; j++)
{
printf("%6d", matrixA[i][j] - matrixB[i][j]);
}
printf("\t|\n");
}
return 0;
}