Advertisement
lol1234561

Untitled

Mar 28th, 2023
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.     public static void main(String[] args) {
  4.         Scanner keyboard = new Scanner(System.in);
  5.  
  6. for(int n = 1 ; n <= 100; n=n+1){
  7.     if (n % 3 == 0 && n % 5 == 0){
  8.         System.out.println("FizzBuzz");
  9.     } else if (n % 3 == 0) {
  10.         System.out.println("Fizz");
  11.        
  12.     } else if (n % 5 == 0){
  13.         System.out.println("Buzz");
  14.     } else {
  15.         System.out.println(n);
  16.     }
  17.  
  18.  
  19. }
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement