Created
March 3, 2011 18:26
-
-
Save alfielapeter/853225 to your computer and use it in GitHub Desktop.
basic 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
for n in 1..100 | |
if n.remainder(3) == 0 && n.remainder(5) == 0 | |
puts "fizzbuzz" | |
elsif n.remainder(3) == 0 | |
puts "fizz" | |
elsif n.remainder(5) == 0 | |
puts "buzz" | |
else | |
puts n | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment