Make A Calculator Using If else Statement in Python

 Make A Calculator Using If else Statement in Python

Code -

num1 = int(input("Enter The First Number: "))
operator = input("Choose Operater +,-,*,/,%:")
num2 = int(input("Enter The Second Number: "))

if operator == "+" :
    print("Output = ",num1+num2)
elif operator == "-" :
    print("Output = ",num1-num2)
elif operator == "*" :
    print("Output = ",num1*num2)
elif operator == "/" :
    print("Output = ",num1/num2)
elif operator == "%" :
    print("Output = ",num1%num2)
else :
    print("Invalid Input!")

Output - 

Enter The First Number: 47
Choose Operater +,-,*,/,%:+
Enter The Second Number: 3
Output =  50


Download Code



Comments

Popular posts from this blog

Write A Python Program, Create n Empty Dictionary Allow 4 Friends To, Enter Their Favorite Programming Language As values and User Keys as their Name Assume That The Names Are Unique.

Write Python Program To Store Seven Fruits Name In a List Enter By The User