Q. Write a program to perform mathematical calculator.
Answer :-
num1 = float(input("Enter the First number:- "))
num2 = float(input("Enter the Second number:- "))
operator = input ("Enter Operator:- ")
if operator == "+":
print (num1 + num2)
elif operator == "-":
print (num1 - num2)
elif operator == "*":
print (num1 * num2)
elif operator == "/":
print (num1 / num2)
else:
print ("invalid input")
Output:-
Enter the First number:- 45
Enter the Second number:- 2
Enter Operator:- *
90.0
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )