Skip to content

Instantly share code, notes, and snippets.

@0xradical
Last active December 15, 2015 02:59
Show Gist options
  • Select an option

  • Save 0xradical/5191122 to your computer and use it in GitHub Desktop.

Select an option

Save 0xradical/5191122 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
1.upto(100).each do |number|
if number % 3 != 0 && number % 5 != 0
puts "#{number}: #{number}"
else
puts "#{number}: #{number % 3 == 0 ? 'Fizz' : '' }#{number % 5 == 0 ? 'Buzz' : ''}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment