Skip to content

Commit

Permalink
Merge pull request #273 from MrB141107/patch-2
Browse files Browse the repository at this point in the history
Create trigonometric_ratios.py
  • Loading branch information
Punit-Choudhary authored Nov 6, 2023
2 parents 0fb3879 + b35a4fb commit a851807
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Math/trigonometric_ratios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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)

0 comments on commit a851807

Please sign in to comment.