-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgramMatriz.java
More file actions
25 lines (22 loc) · 821 Bytes
/
Copy pathProgramMatriz.java
File metadata and controls
25 lines (22 loc) · 821 Bytes
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
import javax.swing.*;
public class ProgramMatriz {
public static void main(String enter[]){
int vetor[] = {2,4,6,8,10};
int matriz[][] = new int [2][3];
String msg = "vetor = ";
for(int i = 0; i < vetor.length; i++){
msg = msg + vetor[i] + " ";
}
JOptionPane.showMessageDialog(null, msg);
msg = "Matriz = \n\n";
for(int i = 0; i < matriz.length; i++){
for(int j = 0; j < matriz[0].length; j++){
matriz[i][j] = Integer.parseInt(JOptionPane.showInputDialog("Enter an integer number to the position: " + i + " e " + j));
msg = msg + matriz[i][j] + " ";
}
msg = msg + "\n";
}
JOptionPane.showMessageDialog(null, msg);
System.exit(0);
}
}