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:
- Multiples of 7 are “Whizz”
- Multiples of 11 are “Bang”
That means that multiples of 3 & 7 will be “FizzWhizz”, multiples of 5 & 11 will be “BuzzBang” etc. Your program should be configurable for which multiples are being used.
Also, extend your printout so it continues either to 100 or until the first time you get a word with a part for every factor. For example, if you have all of 3,5,7,11 enabled, it should stop at “FizzBuzzWhizzBang”, 1155.
Additional rules you could also add:
- Multiples of 13 are “Split”
- Multiples of 17 are “Pop”
Acknowledgments
This kata is described on cyber-dojo, I added the follow-up requirements.