import math
import cmath
run = True
print("welcome to caculator")
print("you can do follwing operations\n 1 Addition\n 2 Subtraction\n 3 Multiplication\n 4 Division\n 5 Modulus\n 6 Floor division\n 7 Exponential\n 8 Square root\n 9 GIF\n 10 Celling function\n 11 Percentage\n 12 reciprocal\n 13 Log\n ")
print ("enter 0 in operations to exit")
op = float(input("eneter the operation you would like to work on"))
while run == True:
if op ==1:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
print(f"the sum is {x+y}")
op = int(input("what is next operation you want to perform"))
elif op ==2:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
print(f"the differecne is {x-y}")
op = float(input("what is next operation you want to perform"))
elif op ==3:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
print(f"the product is {x*y}")
op = float(input("what is next operation you want to perform"))
elif op ==4:
b = False
while b == False:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
if y == 0:
b = False
print("y can not be zero.")
else:
b = True
print(f"the quotient is {x/y}")
op = float(input("what is next operation you want to perform"))
elif op == 5:
c = False
while c == False:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
if y ==0:
c = False
print ("second number can't be 0")
else:
c = True
print(f"the modulus is {x%y}")
op = float(input("what is next operation you want to perform"))
elif op==6:
e = False
while e == False:
x = float(input("enter your first number"))
y = float(input("enter your second number"))
if y ==0:
e = False
print("second number can't be 0")
else:
e = True
print(f"the floor division is {x//y}")
op = float(input("what is next operation you want to perform"))
elif op ==7:
print ("in this you would get result x ^y ")
x = float(input("enter x"))
y = float(input("enter y"))
print(f"result is {x**y}")
op = float(input("what is next operation you want to perform"))
elif op==8:
x = float(input("enter the number"))
print(f"the square root is {cmath.sqrt(x)} ")
op = float(input("what is next operation you want to perform"))
elif op ==9:
x = float(input("enter the number"))
print(f"the GIF is {math.floor(x)} ")
op = float(input("what is next operation you want to perform"))
elif op == 10:
x = float(input("enter the number"))
print(f"the celling function result is {math.ceil(x)}")
op = float(input("what is next operation you want to perform"))
elif op == 11:
f = False
while f == False:
print("this give what percentage x is of y ")
x = float(input("enter x"))
y = float(input("enter y"))
if y ==0:
f = False
print("y can't be 0 ")
else:
f = True
print(f"result is {(x/y)*100}")
op = float(input("what is next operation you want to perform"))
elif op ==12:
d = False
while d==False:
x = float(input("enter the number"))
if x ==0:
d = False
print("number can not be zero")
else:
d = True
print(f"the result is {1/x} ")
op = float(input("what is next operation you want to perform"))
elif op ==13:
g= False
while g == False:
x = float(input("enter the number"))
if x <= 0:
g = False
print("number has to be positive")
else:
g = True
print(f"the result is {math.log10(x)}")
op = float(input("what is next operation you want to perform"))
elif op ==0:
run =False
else:
op = float(input("invalid input . eneter the operation you would like to work on"))