repl.it
@tristanbeedell/

Java 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
16
17
public class Main {
  public static void main(String[] args) {
		for (int i = 0; i < 100; i++){
			String out;
			if (i % 3 == 0 && i % 5 == 0) {
				out = "fizzbuzz";
			} else  if (i % 3 == 0) {
				out = "fizz";
			} else if (i % 5 == 0) {
				out = "fizz";
			} else {
				out = Integer.toString(i);
			}
			System.out.println(out);
		}
  }
}