In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 26th
(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 #03 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.
Write a program that, given an integer n, prints the numbers from 1 to n, one per line. However, for multiples of 3, print "Fizz" instead of the number, and 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 single integer n representing the upper limit of the sequence.
The output should consist of n lines. For each number from 1 to n:
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ n ≤ 50 | Upper limit of sequence |
Example Input 1 | Example Output 1 |
5 |
1 2 Fizz 4 Buzz |
Example Input 2 | Example Output 2 |
10 |
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz |
Example Input 3 | Example Output 3 |
15 |
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz |