Advertisement
Dido09

1 to 100

Jun 19th, 2019
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public class FizzBuzz {
  2. public static void main(String[] args) {
  3. for (int i = 1; i <= 100; i++) {
  4. if (i % 15 == 0) {
  5. System.out.println("FizzBuzz");
  6. } else if (i % 3 == 0) {
  7. System.out.println("Fizz");
  8. } else if (i % 5 == 0) {
  9. System.out.println("Buzz");
  10. } else {
  11. System.out.println(String.valueOf(i));
  12. }
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement