Created
December 8, 2018 02:14
-
-
Save ventureproz/3e845728de43e647b707c9dbc1ee703c 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
puts "simple calculator" | |
25.times { print "-" } | |
puts | |
puts "enter first number" | |
num_1 = gets.chomp | |
puts "enter the second number" | |
num_2 = gets.chomp | |
puts "what do you want to do" | |
puts "(M)ultiple, (D)ivide, (S)ubtraction, (A)ddition, (R)emainder" | |
type = gets.chomp | |
puts "You have selected #{type}" | |
if type == "M" | |
puts "#{num_1} Times #{num_2} equals #{num_1.to_f * num_2.to_f}" | |
elsif type == "D" | |
puts "#{num_1} Divided by #{num_2} equals #{num_1.to_f / num_2.to_f}" | |
elsif type == "A" | |
puts "#{num_1} Plus #{num_2} equals #{num_1.to_f + num_2.to_f}" | |
elsif type == "S" | |
Puts "#{num_1} minus #{num_2} is #{num_1.to_f - num_2.to_f}" | |
elsif type == "R" | |
puts "#The remainder of #{num_1} and #{num_2} is #{num_1.to_f % num_2.to_f}" | |
else | |
puts "You need to select the correct input (Input is Case Sensitive)" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment