-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathTrigonometric_ratios.py
36 lines (29 loc) · 1.08 KB
/
Trigonometric_ratios.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
import math
print("Enter the values of sides of a triangle")
a = float(input("Enter the value of side a: "))
b = float(input("Enter the value of side b: "))
c = float(input("Enter the value of side c: "))
# Calculating the values of sin, cos and tan
sin_a = round((a / c),2)
cos_a = round((b / c),2)
tan_a = round((a / b),2)
# Calculating the values of cosec, sec and cot
cosec_a = round((1 / sin_a),2)
sec_a = round((1 / cos_a),2)
cot_a = round((1 / tan_a),2)
# Printing the values of sin, cos and tan
print("\nThe value of sin a is: ", sin_a)
print("The value of cos a is: ", cos_a)
print("The value of tan a is: ", tan_a)
# Printing the values of cosec, sec and cot
print("The value of cosec a is: ", cosec_a)
print("The value of sec a is: ", sec_a)
print("The value of cot a is: ", cot_a)
# Defining the formula of Heron's to calculate the area of triangle.
def Area(a, b, c):
sp = (a + b + c) / 2
area = (sp) * (sp - a) * (sp - b) * (sp - c)
f_area = round((area**0.5), 2)
print(f"The area of triangle is {f_area}" + " square units")
#Printing the area of triangle.
Area(a,b,c)