-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex024.java
32 lines (26 loc) · 797 Bytes
/
ex024.java
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
package listaexercicios02;
public class ex024 {
public static void main(String[] args) {
String[][] matriz = new String[5][5];
int cont = 0, i, j;
for(i=0; i<matriz.length; i++) {
for(j=0; j<matriz[i].length; j++) {
if(i == cont && j == cont) {
matriz[i][j] = "A";
cont++;
} else if(i == 3 && j == 2) {
matriz[i][j] = "C";
}
else {
matriz[i][j] = "B";
}
}
}
for(i=0; i<matriz.length; i++) {
for(j=0; j<matriz[i].length; j++) {
System.out.printf("[%s] ", matriz[i][j]);
}
System.out.println();
}
}
}