Task

Write a program that prints the integers from   1   to   100   (inclusive).



But:

   for multiples of three,   print   Fizz     (instead of the number)
   for multiples of five,   print   Buzz     (instead of the number)
   for multiples of both three and five,   print   FizzBuzz     (instead of the number) 


The   FizzBuzz   problem was presented as the lowest level of comprehension required to illustrate adequacy.



Also see

   (a blog)   dont-overthink-fizzbuzz
   (a blog)   fizzbuzz-the-programmers-stairway-to-heaven


fun fizzbuzz(n :: NumPositive) -> String:
  doc: ```For positive input which is multiples of three return 'Fizz', for the multiples of five return 'Buzz'. 
  For numbers which are multiples of both three and five return 'FizzBuzz'. Otherwise, return the number itself.```
  ask:
    | num-modulo(n, 15) == 0 then: "FizzBuzz"
    | num-modulo(n, 3) == 0 then: "Fizz"
    | num-modulo(n, 5) == 0 then: "Buzz"
    | otherwise: num-to-string(n)
  end
where:
  fizzbuzz(1) is "1"
  fizzbuzz(101) is "101"
  fizzbuzz(45) is "FizzBuzz"
  fizzbuzz(33) is "Fizz"
  fizzbuzz(25) is "Buzz"
end
 
range(1, 101).map(fizzbuzz).each(print)