-
-
Save ruxandrafed/046528a63bdcd168d731 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fizzbuzz_output(number) | |
result = "" | |
result << "Fizz" if number % 3 == 0 | |
result << "Buzz" if number % 5 == 0 | |
result = number if result.empty? | |
result | |
end | |
def fizzbuzz(a,b) | |
a.upto(b) do |number| | |
puts fizzbuzz_output(number) | |
end | |
end | |
puts "Insert starting number:" | |
starting = gets.chomp.to_i | |
puts "Insert ending number:" | |
ending = gets.chomp.to_i | |
fizzbuzz(starting,ending) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment