Skip to content

Instantly share code, notes, and snippets.

@JoshTGreenwood
Created June 12, 2013 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshTGreenwood/5769114 to your computer and use it in GitHub Desktop.
Save JoshTGreenwood/5769114 to your computer and use it in GitHub Desktop.
def fizzbuzz(n)
(1..n).each do |i|
if i % 15 == 0
puts 'fizzbuzz'
elsif i % 5 == 0
puts 'buzz'
elsif i % 3 == 3
puts 'fizz'
else
puts i.to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment