Initial Commit
This commit is contained in:
parent
8cdd432209
commit
8644842962
1 changed files with 20 additions and 0 deletions
20
fizzbuzz.java
Normal file
20
fizzbuzz.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue