Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package multimatrizes;
- import javax.swing.JOptionPane;
- /**
- *
- * @author Kelvin PC
- */
- public class MultiMatrizes {
- public static void Matriz(){
- int[][] mat1 = new int[5][3];
- int[][] mat2 = new int[3][5];
- int[][] result = new int[5][5];
- int aux = 0;
- // preenche a 1º matriz
- for (int l = 0;l < 5;l++){
- for(int c = 0;c < 3;c++){
- mat1[l][c] = Integer.parseInt(JOptionPane.showInputDialog("Informe o valor da 1º matriz para linha "+l+" coluna "+c+" :") );
- }
- }
- // preenche a 2º matriz
- for (int l = 0;l < 3;l++){
- for(int c = 0;c < 5;c++){
- mat2[l][c] = Integer.parseInt(JOptionPane.showInputDialog("Informe o valor da 2º matriz para linha "+l+" coluna "+c+" :") );
- }
- }
- // multiplica a matriz
- for (int l = 0;l < 5;l++){
- for(int c = 0;c < 5;c++){
- aux = 0;
- for (int i=0; i < 3; i++ ) {
- aux = aux + (mat1[l] * mat2[c]);
- }
- result[l][c] = aux; // aki esta tando o erro
- System.out.print(result[l][c] + " ");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment