A simple algorithm to get input from the user for 2 digits and the operation to perform addition, subtraction and division
Answers
Answered by
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
Chemistry,
1 month ago
English,
1 month ago
English,
1 month ago
Social Sciences,
10 months ago
Math,
10 months ago