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
Comments
Post a Comment