Guest User

Untitled

a guest
Jan 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package edu.hawaii.FizzBuzz;
  2. /*
  3. * Iterates from 1 to 100 and prints Fizz if the number
  4. * is a multiple of 3, Buzz if it's a multiple of 5, FizzBuzz
  5. * if it's a multiple of both, and the number otherwise
  6. *
  7. * Jordan Do
  8. */
  9. public class FizzBuzz {
  10. public static void main(String[] args) {
  11. for (int i = 1; i < 101; i++) {
  12. if (i % 3 == 0) System.out.print("Fizz");
  13. if (i % 5 == 0) System.out.print("Buzz");
  14. if (i % 3 != 0 && i % 5 != 0) System.out.print(i);
  15. System.out.println("");
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment