Skip to content

Instantly share code, notes, and snippets.

@nblackburn87
Created December 29, 2013 00:36
Show Gist options
  • Save nblackburn87/8166064 to your computer and use it in GitHub Desktop.
Save nblackburn87/8166064 to your computer and use it in GitHub Desktop.
FizzBuzz Problem Solution.
puts "What number would you like to FizzBuzz up to?"
var = gets.chomp.to_i
(1..var).each do |x|
if x % 15 == 0
puts "FizzBuzz"
elsif x % 3 == 0
puts "Fizz"
elsif x % 5 == 0
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