Answer to Question #206069 in Python for Jeevansai Gandham

Question #206069

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.




1
Expert's answer
2021-06-11T14:11:34-0400
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS