-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
26 lines (22 loc) · 715 Bytes
/
Copy pathMain.java
File metadata and controls
26 lines (22 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package zone.mafu;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Starting number?");
int starting = sc.nextInt();
System.out.println("Ending number?");
int ending = sc.nextInt();
for(int i = starting; i <= ending; i ++){
if(i % 3 == 0 && i % 5 == 0){
System.out.println("FizzBuzz");
} else if(i % 3 == 0){
System.out.println("Fizz");
} else if(i % 5 == 0){
System.out.println("Buzz");
} else {
System.out.println(i);
}
}
}
}