Skip to content

Instantly share code, notes, and snippets.

@ggongaware
Forked from earlonrails/fizzbuzz.rb
Created August 14, 2012 17:26
Show Gist options
  • Save ggongaware/3351008 to your computer and use it in GitHub Desktop.
Save ggongaware/3351008 to your computer and use it in GitHub Desktop.
FIZZ BUZZ! This is to make sure that no one (myself mainly) has to figure out the fizz buzz problem anymore!
(1..100).each do |x|
str = ((x%3) == 0 ? "fizz" : "") + ((x%5) == 0 ? "buzz" : "")
puts str.empty? ? x : str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment