All tasks
Mediumloopsmath

FizzBuzz

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

Given an integer n, for every number from 1 to n print on its own line: "Fizz" if divisible by 3, "Buzz" if by 5, "FizzBuzz" if by both, otherwise the number itself.

Examples

Example 1
Input
5
Output
1
2
Fizz
4
Buzz

Constraints

  • 1 ≤ n ≤ 10^4
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.