How to create an algorithm to find the sum,diffrence,product or qoutient of two numbers. The user will select with operation to implement.
Answers
Answered by
1
Answer:
Explanation:
# Python program to perform Addition Subtraction Multiplication
# and Division of two numbers
num1 = int(input("Enter First Number: "))
num2 = int(input("Enter Second Number: "))
print("Enter which operation would you like to perform?")
ch = input("Enter any of these char for specific operation +,-,*,/: ")
result = 0
if ch == '+':
result = num1 + num2
elif ch == '-':
result = num1 - num2
elif ch == '*':
result = num1 * num2
elif ch == '/':
result = num1 / num2
elif ch=='%':
result = num1%num2
else:
print("Input character is not recognized!")
print(num1, ch , num2, ":", result)
Similar questions