def fizz_buzz(num) if num % 15 == 0 'Fizz Buzz' elsif num % 3 == 0 'Fizz' elsif num % 5 == 0 'Buzz' else num.to_s end end num = gets.chomp.to_i for i in 1..num puts fizz_buzz(i) end