-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.py
More file actions
35 lines (34 loc) · 933 Bytes
/
Copy pathcalculator.py
File metadata and controls
35 lines (34 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def add(a,b):
print(f"Addition of {a} and {b} is {a+b}")
def sub(a,b):
print(f"Subtraction of {a} and {b} is {a-b}")
def mul(a,b):
print(f"Multiplication of {a} and {b} is {a*b}")
def div(a,b):
print(f"Division of {a} and {b} is {a/b}")
def rem(a,b):
print(f"Remainder of {a} and {b} is {a%b}")
while True:
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Remainder")
print("6. Exit")
print("------------------------------------")
choice=int(input("Enter your choice: "))
if(choice==6):
break
a=int(input("Enter First number: "))
b=int(input("Enter second number: "))
if choice==1:
add(a,b)
elif choice==2:
sub(a,b)
elif choice==3:
mul(a,b)
elif choice==4:
div(a,b)
elif choice==5:
rem(a,b)
print("\n")