Faulty Calculator Without using Function
'''
Design a calculator which will correctly solve all the
problems except the following ones:
45*3=555, 56+9=77, 56/6=4
'''
while True:
num1=int(input("Enter first number: "))
print('''
+ Addition
- Subtraction
* Multiplication
/ Divide
% Remender
''')
choice=input("choice opreation: ")
num2=int(input("Enter second number: "))
if num1==45 and choice=='*' and num2==3:
print("555")
elif num1==56 and choice=='+' and num2==9:
print("77")
elif num1==56 and choice=='/' and num2==6:
print("4")
elif choice=='+':
print("The sum of",num1,"and",num2,"is",num1+num2)
elif choice=='-':
print("The subtraction of",num1,"and",num2,"is",num1-num2)
elif choice=='*':
print("The multiplication of",num1,"and",num2,"is",num1*num2)
elif choice=='/':
print("The divition of",num1,"and",num2,"is",num1/num2)
elif choice=='%':
print("The remender of",num1,"and",num2,"is",num1%num2)
else:
print("Invalid opreation!\nTry Again")
Exit=input('''Due you want calculate again! if you want then,
press Y(yes) or N(not)''')
if Exit=='n':
print("Thank you!! Good bye")
break
Comments
Post a Comment