Skip to content

Instantly share code, notes, and snippets.

@urokuta
Created October 13, 2011 11:37
Show Gist options
  • Save urokuta/1284026 to your computer and use it in GitHub Desktop.
Save urokuta/1284026 to your computer and use it in GitHub Desktop.
fizz buzz
num = ARGV[0]
1.upto(num.to_i) {|i|
if i % 3 == 0 && i % 5 == 0 then
puts "fizzbuzz"
elsif i%3 == 0 then
puts "fizz"
elsif i%5 == 0 then
puts "buzz"
else
puts i
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment