output
run:
54321
xx*xx
xx3xx
xx*xx
12345
BUILD SUCCESSFUL (total time: 0 seconds)
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package buroro;
/**
*
* @author Masiti
*/
public class belajar {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
for (int j = 5; j >= 1; j--) {
if (i == 1) {
System.out.print(j);
}
if (i == 2) {
if (j == 3) {
System.out.print("*");
} else {
System.out.print("x");
}
}
if (i == 3) {
if (j == 3) {
System.out.print("3");
} else {
System.out.print("x");
}
}
if (i == 4) {
if (j == 3) {
System.out.print("*");
} else {
System.out.print("x");
}
}
if (i == 5) {
for (int k = 1; k <= 5; k++) {
System.out.print(k);
}
break;
}
}
System.out.println(" ");
}
}
}
Tidak ada komentar:
Posting Komentar