Created
July 18, 2012 14:27
-
-
Save tdkn/3136502 to your computer and use it in GitHub Desktop.
Ruby de FizzBuzz
This file contains hidden or 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/env ruby | |
# coding: utf-8 | |
# Fizz Buzz | |
1.upto(100) do |i| | |
if i % 15 == 0 | |
print "FizzBuzz " | |
elsif i % 3 == 0 | |
print "Fizz " | |
elsif i % 5 == 0 | |
print "Buzz " | |
else | |
print "#{i} " | |
end | |
print "\n" if i % 10 == 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment