Kamis, 04 Agustus 2011

Java : Contoh program do while

public class do while {
public static void main(String[] args) {
int N = 5;
int i = 1;
do {
int j = 1;
do {
if ((j == i) || (j == N+1-i))
System.out.print(“#”);
else
System.out.print(” “);
j++;
}
while (j <= N);
System.out.println();
i++;
}
while (i <= N);
}
}

Tags : Java, do while, program java, do, while

1 komentar:

  1. Mksih buat programnya, bisa sharing program dengan blog saya juga. :)

    kunjungi balik blog saya juga tentang while :

    http://top-ilmu.blogspot.com/2012/11/contoh-program-java-while-dan-do-while.html

    mksih. :)

    BalasHapus