-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path(07.09.23) Practice 1
29 lines (29 loc) · 872 Bytes
/
(07.09.23) Practice 1
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
#include <stdio.h>
int main() {
int n1, n2, m1, m2;
scanf("%d", &n1);
scanf("%d", &n2);
scanf("%d", &m1);
scanf("%d", &m2);
if (n2 == m1) {
int a[10][10], b[10][10], c[10][10];
for (int i = 0; i < n1; i++) {
for (int j = 0; j < n2; j++) {
scanf("%d", &a[i][j]);}
}
for (int i = 0; i < m1; i++) {
for (int j = 0; j < m2; j++)
scanf("%d", &b[i][j]); }
}
for (int i = 0; i < n1; i++) {
for (int j = 0; j < m2; j++) {
c[i][j] = 0;
for (int k = 0; k < n2; k++) {
c[i][j] += a[i][k] * b[k][j];}
}
}
for (int i = 0; i < n1; i++) {
for (int j = 0; j < m2; j++) {
printf("%d\t", c[i][j]);}
printf("\n ");}
}