Kelipatan 3 Menggunakan While – Do

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package kelipatan3while;

/**
*
* @author KIREINA
*/
public class kelipatan3 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int[] kelipatan3= new int[8];
int i=1;
int index=0;
int nomor=1;
while(i<=25){
if(i%3==0){
kelipatan3[index]=i;
System.out.println("Bilangan kelipatan 3 ke "+nomor+" = "+kelipatan3[index]);
nomor++;
index++;
}
i++;
}
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s