Created
December 11, 2012 16:50
-
-
Save cbojar/4260215 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
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
#!/usr/bin/ruby | |
1.upto(100) do |i| | |
div3 = (i%3).zero? | |
div5 = (i%5).zero? | |
print "Fizz" if div3 | |
print "Buzz" if div5 | |
print i unless div3 or div5 | |
puts "" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment