#K58042. FizzBuzz Generator

    ID: 30554 Type: Default 1000ms 256MiB

FizzBuzz Generator

FizzBuzz Generator

Given a positive integer \(n\), generate a sequence of outputs for each integer from 1 to \(n\) following the FizzBuzz rules:

  • If an integer is divisible by both 3 and 5 (i.e. \(i \mod 15 = 0\)), output FizzBuzz.
  • If an integer is divisible by 3 but not 5 (i.e. \(i \mod 3 = 0\)), output Fizz.
  • If an integer is divisible by 5 but not 3 (i.e. \(i \mod 5 = 0\)), output Buzz.
  • Otherwise, output the integer itself.

The solution should read the input from standard input (stdin) and produce the output on standard output (stdout), with each result printed on a new line.

inputFormat

The input consists of a single integer \(n\) (\(1 \leq n \leq 10^5\)). This integer is read from standard input (stdin).

outputFormat

Output \(n\) lines, where each line contains the result for the corresponding integer in the range from 1 to \(n\) as per the FizzBuzz rules.

## sample
15
1

2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz

</p>