CodeMIRAI
0 XP

FizzBuzz

Easy +30 XP Solved

Read n and print the numbers 1 to n, one per line, but print Fizz for multiples of 3, Buzz for multiples of 5 and FizzBuzz for multiples of both.

Input
5
Expected output
1
2
Fizz
4
Buzz
Input
15
Expected output
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Show a hint

Check multiples of 15 first.

Show a solution
C++
Loading the editor…
Run the tests to check your solution.