FizzBuzz
A children's maths club plays a counting game. The group counts aloud from 1, but any number in the three times table is replaced by the word Fizz, any number in the five times table by Buzz, and a number that belongs to both tables by FizzBuzz. You are writing the screen that shows the whole round so the group can check itself afterwards.
Task: Read how far the round counts and print the round as the group should have said it.
Input
A single line holding one integer n, with 1 ≤ n ≤ 1000.
Output
n lines, one for each number i counting up from 1 to n. A line holds FizzBuzz when i is divisible by both 3 and 5, Fizz when it is divisible by 3 only, Buzz when it is divisible by 5 only, and otherwise the number i itself.
Example:
Input:
5
Output:
1
2
Fizz
4
Buzz
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in