Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- puts "Enter the first number"
- first=gets.chomp().to_f
- puts "Enter the second number"
- second=gets.chomp().to_f
- op=""
- while (op!=5)
- puts "Enter the operation you wish to perform"
- puts "1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n5.Exit"
- op=gets.chomp()
- if op=="1"
- sum=first+second
- puts "The addition of two numbers is "+sum.to_s
- elsif op=="2"
- sub=first-second
- puts "The subtraction of two numbers is "+sub.to_s
- elsif op=="3"
- mul=first*second
- puts "The multiplication of two numbers is "+mul.to_s
- elsif op=="4"
- div=first/second
- puts "The division of two numbers is "+div.to_s
- elsif op=="5"
- exit
- else
- puts "Invalid Selection"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement