Write a python program to make a simple calculator .
PROGRAM:
print("**********SIMPLE CALCULATOR**************")
n1=float(input("Enter a number1:"))
operator=input("Enter(+ or - or * or / or ^ or %)=")
n2=float(input("Enter a number2:"))
print("----------------RESULT------------------")
if (operator=="+"):
print("Result:",n1+n2)
print("----------------INFINITY NOTES(∞)---------")
elif (operator=="-"):
print("Result:",n1-n2)
print("----------------INFINITY NOTES(∞)---------")
elif (operator=="*"):
print("Result:",n1*n2)
print("----------------INFINITY NOTES(∞)---------")
elif (operator=="/"):
print("Result:",n1/n2)
print("----------------INFINITY NOTES(∞)----------")
elif (operator=="^"):
print("Result:", n1**n2)
print("----------------INFINITY NOTES(∞)----------")
elif (operator=="%"):
print("Result:", n1/100)
print("----------------INFINITY NOTES(∞)---------")
else:
print("**********Sorry**********")
print("Invalid operation")
print("----------------INFINITY NOTES(∞)---------")
No comments:
Post a Comment