Skip to content

Instantly share code, notes, and snippets.

@tdkn
Created July 18, 2012 14:27
Show Gist options
  • Save tdkn/3136502 to your computer and use it in GitHub Desktop.
Save tdkn/3136502 to your computer and use it in GitHub Desktop.
Ruby de FizzBuzz
#!/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