Write a python program to make a simple calculator .

                              https://infinitynotes00.blogspot.com/2021/08/Write a python program to make a simple calculator./image.png

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




Copyright Ⓒ 2022 | Mechpedia | All Right Reserved.