Computer Science, asked by Prabalpratap6570, 2 months ago

A simple algorithm to get input from the user for 2 digits and the operation to perform addition, subtraction and division

Answers

Answered by IamArkaSaha
0

Answer:

I am giving answer in Python, if u need any other language contact me via discord : ☞ ARKA ` SAHA ☜#0471

In Python:

Explanation:

num1 = input("Enter Num 1 > "

num2 = input("Enter Num 2> "

opr = input("Enter Operation(add, sub, mul, div)").toLower()

if opr == "add":

     print(f"Add:  {num1 + num2}")

elif opr == "sub":

     print(f"Sub:  {num1 - num2}")

elif opr == "div":

     print(f"Division:  {num1 / num2}")

elif opr == "mul":

     print(f"Multiply:  {num1 * num2}")

else:

    print("Wrong Operator")

Similar questions