Skip to content

Commit a851807

Browse files
Merge pull request #273 from MrB141107/patch-2
Create trigonometric_ratios.py
2 parents 0fb3879 + b35a4fb commit a851807

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Math/trigonometric_ratios.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
print("Enter the values of sides of a triangle")
2+
a = float(input("Enter the value of side a: "))
3+
b = float(input("Enter the value of side b: "))
4+
c = float(input("Enter the value of side c: "))
5+
6+
# Calculating the values of sin, cos and tan
7+
sin_a = round((a / c), 2)
8+
cos_a = round((b / c), 2)
9+
tan_a = round((a / b), 2)
10+
11+
# Calculating the values of cosec, sec and cot
12+
cosec_a = round((1 / sin_a), 2)
13+
sec_a = round((1 / cos_a), 2)
14+
cot_a = round((1 / tan_a), 2)
15+
16+
# Printing the values of sin, cos and tan
17+
print("\nThe value of sin a is: ", sin_a)
18+
print("The value of cos a is: ", cos_a)
19+
print("The value of tan a is: ", tan_a)
20+
21+
# Printing the values of cosec, sec and cot
22+
print("The value of cosec a is: ", cosec_a)
23+
print("The value of sec a is: ", sec_a)
24+
print("The value of cot a is: ", cot_a)
25+
26+
27+
# Defining the formula of Heron's to calculate the area of triangle.
28+
def Area(a, b, c):
29+
sp = (a + b + c) / 2
30+
area = (sp) * (sp - a) * (sp - b) * (sp - c)
31+
f_area = round((area**0.5), 2)
32+
print(f"The area of triangle is {f_area}" + " square units")
33+
34+
35+
# Printing the area of triangle.
36+
Area(a, b, c)

0 commit comments

Comments
 (0)