Skip to content

Instantly share code, notes, and snippets.

@stevekinney
Created November 24, 2011 00:49
Show Gist options
  • Save stevekinney/1390373 to your computer and use it in GitHub Desktop.
Save stevekinney/1390373 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
1.upto(100) do |x|
if x % 3 == 0 && x % 5 == 0
puts "FizzBuzz"
elsif x % 3 == 0
puts "Fizz"
elsif x % 5 == 0
puts "Buzz"
else
puts x
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment