repl.it
@katiewinton/

fizzbuzz

Java

No description

fork
loading
Files
  • Main.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Main {
  public static void main(String[] args) {
    for(int i = 1; i < 101; i++){
      if(i % 3 == 0 && i % 5 == 0){
        System.out.println(i + " FizzBuzz");
      } else if(i % 3 == 0){
        System.out.println(i + " Fizz");
      } else if(i % 5 == 0){
        System.out.println(i + " Buzz");
      } else{
        System.out.println(i);
      }
    }
  }
}
?