In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of March 10th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #02 exercise sheet]
The game of FizzBuzz is a popular programming challenge to test basic logic and iteration skills. The rules are simple: count up from 1 to a given number and replace some numbers with the words "Fizz" or "Buzz" according to specific rules. Since you do do not learned about cycles (yet), here you will have a simplified version.
Write a program that, given an integer N, prints the number, except in the following cases: for multiples of 3, print "Fizz" instead of the number; for multiples of 5, print "Buzz" instead of the number; for numbers that are multiples of both 3 and 5, print "FizzBuzz".
The input consists of a line with a single integer N.
The output should be a single line containing:
"Fizz"
if the number is divisible by 3."Buzz"
if the number is divisible by 5."FizzBuzz"
if the number is divisible by both 3 and 5.The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ N ≤ 1 000 000 | The input number |
Example Input 1 | Example Output 1 |
5 |
Buzz |
Example Input 2 | Example Output 2 |
6 |
Fizz |
Example Input 3 | Example Output 3 |
15 |
FizzBuzz |
Example Input 4 | Example Output 4 |
13 |
13 |