1. Fizz Buzz

EasyProgramFree10 points

Write fizzBuzz n, which describes the number n the way the counting game does: "Fizz" when n is divisible by 3, "Buzz" when it is divisible by 5, "FizzBuzz" when it is divisible by both, and the number itself, as a string, otherwise.

Examples

  1. Input: fizzBuzz 3Output: "Fizz"
  2. Input: fizzBuzz 10Output: "Buzz"
  3. Input: fizzBuzz 30Output: "FizzBuzz"
  4. Input: fizzBuzz 7Output: "7"

Submitting also runs 8 hidden tests.

Constraints

  • 0 is divisible by every number.
  • toString n turns a number into its decimal string: toString 7 is "7".
Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser