Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /*
  2. * Tyler Kelley
  3. * October 4th, 2019
  4. * CSC-111-D01
  5.  
  6. */
  7. import java.util.Scanner;
  8. public class InClassFizzBuzz {
  9.  
  10. public static void main(String[] args) {
  11.  
  12. Scanner input = new Scanner(System.in);
  13.  
  14. System.out.println("Enter a whole number: ");
  15. int number = input.nextInt();
  16.  
  17. if (number % 3 == 0) {
  18. if (number % 5 == 0) {
  19. System.out.println("fizzbuzz");
  20. } else {
  21. System.out.println("fizz");
  22. }
  23. } else if (number % 5 == 0) {
  24. System.out.println("buzz");
  25. }
  26. else System.out.println(number);
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement