Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Robert Thibodeau
- */
- package fizzbuzz;
- import java.util.Scanner;
- public class FizzBuzz {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter a number.");
- double userin = input.nextDouble();
- int result5 = (int) userin % 5;
- int result3 = (int) userin % 3;
- if (result5 == 0)
- System.out.print("Fizz ");
- if (result3 == 0)
- System.out.print("Buzz");
- else if (result3 > 0 && result5 > 0)
- System.out.print(userin);
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement