Created
March 17, 2015 20:51
-
-
Save falonofthetower/6a3893efdc04cffe6435 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
begin | |
puts "Please enter your first number." | |
a = gets.chomp | |
puts "Please enter your second number." | |
b = gets.chomp | |
puts "Here are your instructions...." | |
puts "Enter + if you want to add the numbers." | |
puts "Enter - if you want to subtract the numbers." | |
puts "Enter * if you want to multiply the numbers." | |
puts "Enter / if you want to divide the numbers." | |
operation = gets.chomp | |
if operation == "+" | |
puts a.to_i + b.to_i | |
elsif operation == "-" | |
puts a.to_i - b.to_i | |
elsif operation == "*" | |
puts a.to_i * b.to_i | |
elsif operation == "/" | |
puts a.to_f / b.to_f | |
end | |
puts "Would you like to calculate more numbers?" | |
puts "Enter y for Yes and n for No" | |
request = gets.chomp | |
if request == "y" | |
puts "Here we go again!" | |
else | |
puts "Good bye." | |
end | |
end until request == "n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment