//Demo while
public class DemoWhile {
public static void main(String args[]) {
int n = 10;
while(n > 0) {
System.out.println("nomor " + n);
n--;
}
}
}
Hasilnya:
run:
nomor 10
nomor 9
nomor 8
nomor 7
nomor 6
nomor 5
nomor 4
nomor 3
nomor 2
nomor 1
BUILD SUCCESSFUL (total time: 0 seconds)
0 komentar:
Posting Komentar