FizzBuzz

Difficulty:
Elementary

Tags:
arithmetic, strings

Instructions:
If a number is divisible by 3, return "Fizz". If a number is divisible by 5, return "Buzz". If a number is divisible by 3 and 5, return "FizzBuzz"

Code:
def fizzbuzz(x)
  ___
end

assert_equal fizzbuzz(3), "Fizz"
assert_equal fizzbuzz(50), "Buzz"
assert_equal fizzbuzz(15), "FizzBuzz"
assert_equal fizzbuzz(5175), "FizzBuzz"

Your Solution


Back to Problems