Quick actions

cmd+k|ctrl+k

Navigation

Languages

JavaFizzBuzzExercise

Snippet info

Language

Java

Visibility

public

Author

masterhun

Created

2023-12-20T15:50:53.380861Z

Updated

2023-12-20T16:45:37.119609Z

class Main {
    public static void main(String[] args) {
        
        
        /* 
        
        FIZZ, a multiple of 3 
        
        BUZZ, a multiple of 5 
        
        FIZZBUZZ, a multiple of 3 & 5 or 15 
        
        */
        
        System.out.println("FIZZ! BUZZ! FIZZBUZZ!");
        
        int end = 20; 
        
        for (int i = 1; i <= end; i++) {
            
            // if i is a multiple of 3 and 5, then it's FIZZBUZZ. 
            if (MISSING CODE) {
                System.out.println("FizzBuzz");
                
            // if i is a multiple of 3, then it's FIZZ. 
            } else if (MISSING CODE) {
                System.out.println("Fizz");
            
            // if i is a multiple of 5, then it's BUZZ.     
            } else if (MISSING CODE) {
                System.out.println("Buzz");
                
            // if i isn't FIZZBUZZ or FIZZ or BUZZ, then it's just itself. 
            } else {
                System.out.println(i);
            }
        }
        
        
        
    }
}
INFO