Tugas Fizzbuzz

langkah pertama buat scrip nya di notepad

public class FizzBuzzdevi{
public static void main (String[] args){
for (int i = 1;i<100;i++){
if(i%3 == 0 && i % 5 == 0){
System.out.println(“FizzBuzz”);
} else if (i % 3 == 0) {
System.out.println(“Fizz”);
}
else if (i % 5 == 0){
}
else{
System.out.println(i);
}
}
}
}

lalu simpan di D jangan lupa pakai .java
kemudian tampilkan di cmd
seperti biasa ketik dahulu d: jika kita menyimpannya di d
kemudian tulis javac nama file
contoh
D\: javac FizzBuzzdevi.java
D\: java FizzBuzzdevi

kemudian timbullah hasil nya.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s