-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCalculator-CUI.py
More file actions
27 lines (27 loc) · 807 Bytes
/
Calculator-CUI.py
File metadata and controls
27 lines (27 loc) · 807 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
n1 = float(input("Enter first number: "))
n2 = float(input("Enter second number: "))
print("Operators:\n1. + for addition\n2. - for subtraction\n3. * for multiplication\n4. / for division\n5. // for integer division\n6. % for modulus\n7. ** for exponentiation")
op = input("Enter an arithmetic operator (1 to 7): ")
if op=="1":
re=n1+n2
print("Sum is:",re,".")
elif op=="2":
re=n1-n2
print("Difference is:",re,".")
elif op=="3":
re=n1*n2
print("Product is:",re,".")
elif op=="4":
re=n1/n2
print("Complete quotient is:",re,".")
elif op=="5":
re=n1//n2
print("Quotient is:",re,".")
elif op=="6":
re=n1%n2
print("Remainder of division is:",re,".")
elif op=="7":
re=n1**n2
print("Power is:",re,".")
else:
print("Please enter a number from 1 to 7...")