Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FizzBuzz {
- public static void main(String[] args) {
- final String EMPTY = "";
- for (int i = 1; i <= 100; i++) {
- String value = EMPTY;
- if (i % 3 == 0) value += "Fizz";
- if (i % 5 == 0) value += "Buzz";
- if (value == EMPTY) value += i;
- System.out.println(value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement