#C7242. FizzBuzz Sequence
FizzBuzz Sequence
FizzBuzz Sequence
Given a positive integer \(m\), print the numbers from 1 to \(m\) with the following rules:
- If the number is a multiple of 3, output
Fizz
. - If it is a multiple of 5, output
Buzz
. - If it is a multiple of both 3 and 5 (i.e. \(i \equiv 0 \pmod{3}\) and \(i \equiv 0 \pmod{5}\)), output
FizzBuzz
. - Otherwise, output the number itself.
Each output should be printed on a new line.
This is a classic programming task that tests basic control structures and conditional logic.
inputFormat
A single integer (m) is given on standard input.
outputFormat
Print the sequence from 1 to (m) following the special rules on separate lines on standard output.## sample
5
1
2
Fizz
4
Buzz
</p>