-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathArithmetic_calculator.py
52 lines (51 loc) · 1.96 KB
/
Arithmetic_calculator.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import math
print("What type to Calculation you want to do: 1. Basic Arithmetic\n\t\t\t\t\t\t\t\t\t\t 2. Trigonometric\n\t\t\t\t\t\t\t\t\t\t 3. Exit -->")
n = int(input("Enter a number:"))
if n == 1:
print("Select one: 1. Sum\n\t\t\t2. Difference\n\t\t\t3. Multiplication\n\t\t\t4. Division\n\t\t\t5. Exit -->")
n1 = int(input())
if n1 == 1:
number_1 = int(input("Enter the number 1: "))
number_2 = int(input("Enter the number 2: "))
print("The Sum of Two Numbers: ",number_1 + number_2)
elif n1 == 2:
number_1 = int(input("Enter the number 1: "))
number_2 = int(input("Enter the number 2: "))
print("The Diffference of Two Numbers: ", number_1 - number_2)
elif n1 == 3:
number_1 = int(input("Enter the number 1: "))
number_2 = int(input("Enter the number 2: "))
print("The Multiplication of Two Numbers: ", number_1 * number_2)
elif n1 == 4:
number_1 = int(input("Enter the number 1: "))
number_2 = int(input("Enter the number 2: "))
print("The Division of Two Numbers: ", number_1 / number_2)
elif n1 == 5:
print("Thanks for using",exit())
elif n == 2:
print("Enter the Trigonometric function\n sin,cos,tan,sec,cosec,cot")
trigo = input()
angle = int(input("Enter the value of the angle"))
if trigo in ["sin","cosec"]:
sin = math.sin(angle)
if trigo == "sin":
print(f"sin({angle}) = {sin}")
else:
cosec = 1/sin
print(f"cosec({angle}) = {cosec}")
elif trigo in ["cos","sec"]:
cos = math.cos(angle)
if trigo == "cos":
print(f"cos({angle}) = {cos}")
else:
sec = 1/cos
print(f"sec({angle}) = {sec}")
elif trigo in ["tan","cot"]:
tan = math.tan(angle)
if trigo == "tan":
print(f"tan({angle}) = {tan}")
else:
cot = 1/tan
print(f"cot({angle}) = {cot}")
else:
exit()