20 lines
544 B
Java
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++;
|
|
}
|
|
}
|
|
}
|
|
}
|