Selamat Datang Di Nuryanti Hikaru-Akira Kokoroga Ki-zutsuku ✿ ◠‿ ◠ (▼).

Wednesday, October 9, 2013

Tugas PBO1

Program untuk menampilkan bilangan ganjil dengan menggunakan perulangan :


package SEMESTER3;

/**
 *
 * @author user
 */
public class For_BilGanjil1 {
    public void CetakBilangan(int x){
        for (int i=1 ; i<x ; i++){
            if (i%2!=0){
                System.out.print(i+" ");
            }
        }
    }
    public static void main(String[] args){
        For_BilGanjil1 n = new For_BilGanjil1 ();
        n.CetakBilangan(10);
    }

}



run:
1 3 5 7 9 BUILD SUCCESSFUL (total time: 0 seconds)

0 komentar:

Post a Comment

By :
Free Blog Templates