
Arrays!!
Publicado por Carlos Uriel (2 intervenciones) el 22/09/2015 21:17:55
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
/*
Escribir un programa que lea el array:
4 7 1 3 5
2 0 6 9 7
3 1 2 6 4
y lo escriba como:
4 2 3
7 0 1
1 6 2
3 9 6
5 7 4
*/
import javax.swing.JOptionPane;
public class program3 {
public static void main(String [] args){
String ax="";
int arreglo[][] = {
{4,7,1,3,5},
{2,0,6,9,7},
{3,1,2,6,4}
};
for (int i=0; i<arreglo.length; i++){
for (int j=0; j<arreglo[i].length; j++){
ax+= arreglo[i][j]+" ";
}
ax+="\n";
}
JOptionPane.showMessageDialog(null, ax);
}
}
Valora esta pregunta


0