-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnhan3matrangiaringuyen.c
More file actions
41 lines (41 loc) · 962 Bytes
/
nhan3matrangiaringuyen.c
File metadata and controls
41 lines (41 loc) · 962 Bytes
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
#include <stdio.h>
void nhapmang(int m, int n, int a[][10])
{
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
scanf("%d", &a[i][j]);
}
void inmang(int m, int n, int a[][10])
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
printf("%d ", a[i][j]);
printf("\n");
}
}
void nhan2mang(int m, int n, int p, int a[][10], int b[][10], int d[][10])
{
int h;
for (int i = 0; i < m; i++)
for (int j = 0; j < p; j++)
{
h = 0;
while (h < n)
{
d[i][j] += a[i][h] * b[h][j];
h++;
}
}
}
int main()
{
int m, n, p, q, a[10][10], b[10][10], c[10][10], d[10][10] = {0}, e[10][10] = {0};
scanf("%d%d%d%d", &m, &n, &p, &q);
nhapmang(m, n, a);
nhapmang(n, p, b);
nhapmang(p, q, c);
nhan2mang(m, n, p, a, b, d);
nhan2mang(m, p, q, d, c, e);
inmang(m, q, e);
}