Created
October 21, 2011 01:37
-
-
Save earlonrails/1302897 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!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each do |x| | |
case | |
when 0 == ((x%3)+(x%5)) | |
puts "fizz buzz" | |
when 0 == (x%3) | |
puts "fizz" | |
when 0 == (x%5) | |
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