-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathjava.java
More file actions
23 lines (21 loc) · 491 Bytes
/
java.java
File metadata and controls
23 lines (21 loc) · 491 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class java
{
public static void main(String[] args)
{
for (int i=1; i<=100; i++) {
fizzBuzz(i);
}
}
public static void fizzBuzz(int num)
{
if (num % 15 == 0) {
System.out.println("FizzBuzz");
} else if (num % 5 == 0) {
System.out.println("Buzz");
} else if (num % 3 == 0) {
System.out.println("Fizz");
} else {
System.out.println(num);
}
}
}