Function Kata "FizzBuzz"

 

Write a function that returns the numbers from 1 to 100. However, some numbers should be translated [1]:

  • Fizz" is output for multiples of 3.
  • For multiples of 5, spend "Buzz".
  • For multiples of 3 and 5, enter "FizzBuzz".

Example:

1
2
Fizz
4
Buzz
Fizz
7
...
14
FizzBuz
16
...

Variation

"Fizz" should also be returned if the number contains a 3 as a digit, e.g. 13. "Buzz" should also be returned if the number contains a 5 as a digit, e.g. 52.

Source

[1] http://codingdojo.org/cgi-bin/wiki.pl?KataFizzBuzz

en_USEnglish