ayuda no me multiplica la 2 matrices no me da el resultado correcto public static Matriz multipli
Publicado por diego (1 intervención) el 01/07/2019 23:54:11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public static Matriz multiplicacion(Matriz matrizA, Matriz matrizB) {
Integer suma=0;
if (matrizA.getNroColumnas() == matrizB.getNroFilas()) {
for (int i = 0; i < matrizA.getNroFilas(); i++) {
for (int j = 0; j < matrizB.getNroColumnas(); j++) {
for (int k = 0; k < matrizB.getNroColumnas(); k++) {
suma= matrizA.getValor(i, k) * matrizB.getValor(k, j);
matrizC.setValor(i, j, suma);
}
}
}
} else {
JOptionPane.showMessageDialog(null, "Dimensiones Incorrectas", "ERROR", JOptionPane.WARNING_MESSAGE);
}
return matrizC;
}
Valora esta pregunta


0