Skip to content

Instantly share code, notes, and snippets.

@ognevsky
Created January 26, 2011 12:17
Show Gist options
  • Save ognevsky/796616 to your computer and use it in GitHub Desktop.
Save ognevsky/796616 to your computer and use it in GitHub Desktop.
Simple fizzbuzz problem, solved in ruby
(1..100).each do |x|
if (x % 3).zero? && (x % 5).zero?
puts "FizzBuzz"
elsif (x % 3).zero?
puts "Fizz"
elsif (x % 5).zero?
puts "Buzz"
else
puts x
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment