-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultMatrices.groot
More file actions
78 lines (68 loc) · 1.57 KB
/
multMatrices.groot
File metadata and controls
78 lines (68 loc) · 1.57 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Programa multMatrices;
Variables
i, j, k : Entero;
mat1[2][3] : Entero;
mat2[3][5] : Entero;
mat3[2][5] : Entero;
Principal() {
# MATRIZ 1
# 2 4 5
# 3 7 -5
mat1[0][0] = 2;
mat1[0][1] = 4;
mat1[0][2] = 5;
mat1[1][0] = 3;
mat1[1][1] = 7;
mat1[1][2] = -5;
Escribir("La matriz 1 tiene...");
Desde (i = 0) Hasta 2 Hacer {
Desde (j = 0) Hasta 3 Hacer {
Escribir(mat1[i][j]);
}
}
# MATRIZ 2
# 7 0 10 -1 1
# 9 3 1 -11 20
# 8 8 9 2 -2
mat2[0][0] = 7;
mat2[0][1] = 0;
mat2[0][2] = 10;
mat2[0][3] = -1;
mat2[0][4] = 1;
mat2[1][0] = 9;
mat2[1][1] = 3;
mat2[1][2] = 1;
mat2[1][3] = -11;
mat2[1][4] = 20;
mat2[2][0] = 8;
mat2[2][1] = 8;
mat2[2][2] = 9;
mat2[2][3] = 2;
mat2[2][4] = -2;
Escribir("La matriz 2 tiene...");
Desde (i = 0) Hasta 3 Hacer {
Desde (j = 0) Hasta 5 Hacer {
Escribir(mat2[i][j]);
}
}
Escribir("Multiplicamos las matrices...");
# Multiplicacion de matrices
Desde (i = 0) Hasta 2 Hacer {
Desde (j = 0) Hasta 5 Hacer {
mat3[i][j] = 0;
}
}
Desde (i = 0) Hasta 2 Hacer {
Desde (j = 0) Hasta 5 Hacer {
Desde (k = 0) Hasta 3 Hacer {
mat3[i][j] = mat3[i][j] + mat1[i][k] * mat2[k][j];
}
}
}
Escribir("La matriz resultante da...");
Desde (i = 0) Hasta 2 Hacer {
Desde (j = 0) Hasta 5 Hacer {
Escribir(mat3[i][j]);
}
}
}