Created
November 22, 2011 05:13
-
-
Save octosteve/1384946 to your computer and use it in GitHub Desktop.
FizzBuzz
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.upto(100) do |num| | |
if num % 3 == 0 || num % 5 == 0 | |
if num % 3 == 0 | |
print "Fizz" | |
end | |
if num % 5 == 0 | |
print "Buzz" | |
end | |
else | |
print num | |
end | |
puts | |
end |
Nice! I didn't think to check for '15'... where's your print statements?!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this was my fizzbuzz...though there were some way crazier ones: https://gist.github.com/1383759
here it is..its a one-liner :)