FizzBuzz

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”.

Sample output:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
... etc up to 100

Follow-up requirements

When you have the above program working, extend it with the following rules:

That means for example that multiples of 3 & 7 are “FizzWhizz”, multiples of 5 & 11 are “BuzzBang” etc. Extend your printout so it continues beyond 100 and stops the first time you get “FizzBuzzWhizzBang”.

Acknowledgments

This kata is described on cyber-dojo.org, I added the follow-up requirements.

Referenced in these Learning Hours: