Training Site
Sideways banner 8b44c02b768aa359c4d0a2bce3b247c6d7ab888f8b26852e9bfc3659c8c25612

Fizzbuzz

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 100 megabytes
Time limit: 1.0 seconds

Write a program that counts from 1 to N but for every number divisible by 3 print “Fizz” and for every number divisible by 5 print “Buzz”. If a number is both a multiple of 3 and 5 print “FizzBuzz”.

Hint: use the remainder operator %.

  • Sample Input 1

    5
    

    Sample Output 1

    1
    2
    Fizz
    4
    Buzz