Last active
June 22, 2016 02:59
-
-
Save shinobcrc/71f1ec5e97a08abf8c2e96f225aa12bc 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
def fizzbuzz(max) | |
(1..max).each do |i| | |
if i % 15 == 0 | |
puts "FizzBuzz" | |
elsif i % 5 == 0 | |
puts "Buzz" | |
elsif i % 3 == 0 | |
puts "Fizz" | |
else | |
puts i | |
end | |
end | |
end | |
fizzbuzz(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment