Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- import java.util.Arrays;
- public class Globales
- {
- public static void main(String args[])
- {
- int arreglo [][] = new int [3][3];
- int arreglo2 [][] = new int [3][3];
- int arreglo3 [][] = new int [3][3];
- int arreglo4 [][] = new int [3][3];
- for(int r = 0; r < 3; r++)
- {
- for(int c = 0; c < 3; c++)
- {
- arreglo[r][c] = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingresa el numero", JOptionPane.QUESTION_MESSAGE));
- }
- }
- for(int r=0; r<3; r++)
- {
- for(int c=0; c<3; c++)
- {
- arreglo2[r][c] = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingresa datos", JOptionPane.QUESTION_MESSAGE));
- }
- }
- for(int r=0; r<3; r++)
- {
- for(int c=0; c<3; c++)
- {
- arreglo3[r][c] = arreglo[r][c] + arreglo2[r][c];
- }
- }
- for(int r=0; r<3; r++)
- {
- for(int c=0; c<3; c++)
- {
- for(int k=0; k<3; k++)
- {
- arreglo4[r][c] = arreglo4[r][c] + (arreglo[r][k] * arreglo2[k][c]);
- }
- }
- }
- JOptionPane.showMessageDialog(null, "La suma y multiplicaion de las matrices son:","resultado", JOptionPane.PLAIN_MESSAGE);
- JOptionPane.showMessageDialog(null, Arrays.deepToString( arreglo, arreglo2 ) );
- JOptionPane.showMessageDialog(null, Arrays.deepToString( arreglo2 ) );
- JOptionPane.showMessageDialog(null, Arrays.deepToString( arreglo3 ) );
- JOptionPane.showMessageDialog(null, Arrays.deepToString( arreglo4 ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment