Buat sebuah
program yang mencetak nama Anda selama seratus
kali. Buat tiga versi
program ini menggunakan
while loop, do while dan for-loop.
public class While { public static void main(String args[]){ int r=0; while (r<100){ System.out.println("RESTIYANTI"); r++; } } }Listing program menggunakan do-while::
public class DoWhile { public static void main(String args[]){ int r = 0; do { System.out.println("RESTIYANTI"); r++; } while (r<100); } }Listing program menggunakan for loop::
public class For { public static void main(String args[]){ int r; for (r=0; r<100; r++){ System.out.println("RESTIYANTI"); } } }
2 comments:
mana out put nya?
Visit Us>thanks for the useful article, improve it again
Posting Komentar