Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Tyler Kelley
- * October 4th, 2019
- * CSC-111-D01
- */
- import java.util.Scanner;
- public class InClassFizzBuzz {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.println("Enter a whole number: ");
- int number = input.nextInt();
- if (number % 3 == 0) {
- if (number % 5 == 0) {
- System.out.println("fizzbuzz");
- } else {
- System.out.println("fizz");
- }
- } else if (number % 5 == 0) {
- System.out.println("buzz");
- }
- else System.out.println(number);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement