Java/fizzbuzz.java
Emma Nora Theuer 8644842962 Initial Commit
2024-09-04 12:55:46 +02:00

20 lines
544 B
Java

public class fizzbuzz{
public static void main(String[] args) {
Integer i = 1;
while (true) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.println("fizzbuzz");
i++;
} else if (i % 3 == 0) {
System.out.println("fizz");
i++;
} else if (i % 5 == 0) {
System.out.println("buzz");
i++;
} else {
System.out.println(i);
i++;
}
}
}
}