Skip to content

Commit 987a75e

Browse files
authored
Update requested changes
1 parent 19cb2b5 commit 987a75e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Others/FizzBuzz.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
//NewCoder171
22
//FizzBuzz is a popular interview question where you output either Fizz or Buzz when an input value is divisible by 3 or 5 respectively and FizzBuzz if divisible by both 3 and 5
33

4-
public class buzz {
4+
public class FizzBuzz {
55

66
public static void fizzBuzz(int n){
77
for (int i = 1; i < n; i++) {
8-
if( i % 3 == 0 && i % 5 == 0){
9-
System.out.println("FizzBuzz");
10-
} else if( i % 3 == 0){
11-
System.out.println("Fizz");
12-
} else if( i % 5 == 0){
13-
System.out.println("Buzz!");
14-
} else {
15-
System.out.println(i);
8+
if( i % 3 == 0 && i % 5 == 0){
9+
System.out.println("FizzBuzz");
10+
} else if( i % 3 == 0){
11+
System.out.println("Fizz");
12+
} else if( i % 5 == 0){
13+
System.out.println("Buzz!");
14+
} else {
15+
System.out.println(i);
16+
}
1617
}
1718
}
1819
}

0 commit comments

Comments
 (0)