Input
The input will be a single line containing two integers and operator(+, -, *, /, and %) similar to 3 + 5.
Output
If the given operator is "+", print the sum of two numbers.
If the given operator is "-", print the result of the subtraction of the two numbers.
If the given operator is "*", print the multiplication of the two numbers.
If the given operator is "/", print the result of the division of the two numbers.
If the given operator is "%", print the result of the modulus operation of the two numbers.
n1 = int(input("Enter first Number: "))
n2 = int(input("Enter second Number: "))
op = str(input("Enter the Operation: "))
if op == "+":
print("Result of ",n1,op,n2,"=" , (n1 + n2))
elif op == "-":
print("Result of ",n1,op,n2,"=" , (n1 - n2))
elif op == "*":
print("Result of ",n1,op,n2,"=" , (n1 * n2))
elif op == "/":
print("Result of ",n1,op,n2,"=" , (n1 / n2))
elif op == "%":
print("Result of ",n1,op,n2,"=" , (n1 % n2))
Comments
Leave a comment