This is a Rosetta Code post.
Story
A popular interview question is the FizzBuzz test
, its based on a children’s game where you count from 1 to 100 and for multiples of 3 say ‘Fizz’, multiples of 5 say “Buzz”, if both say ‘FizzBuzz’ else say the number.
For example, a typical round of fizz buzz would start as follows:
1 | 1 |
Task
Write a program that prints the numbers from 1 to 100. But for multiples of three print Fizz
instead of the number and for the multiples of five print Buzz
. For numbers which are multiples of both three and five print FizzBuzz
.
Solutions
Recursive
TODO!
Iterative
1 | public void GetFizzBuzz() |