Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public class FizzBuzz {
  2. public static void main(String[] args) {
  3. final String EMPTY = "";
  4. for (int i = 1; i <= 100; i++) {
  5. String value = EMPTY;
  6. if (i % 3 == 0) value += "Fizz";
  7. if (i % 5 == 0) value += "Buzz";
  8. if (value == EMPTY) value += i;
  9. System.out.println(value);
  10. }
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement