Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions trigonometric_ratios.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import java.util.*;

public class trigonometric_ratios {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the value of sides A : ");
double a = sc.nextInt();
System.out.print("Enter the value of sides B : ");
double b = sc.nextInt();
System.out.print("Enter the value of sides C : ");
double c = sc.nextInt();

// Defining the trigonometric ratios sin, cos, tan
double sin = a / c;
double cos = b / c;
double tan = a / b;

// Defining the trigonometric ratios sec, cosec, cot
double sec = 1 / cos;
double cosec = 1 / sin;
double cot = 1 / tan;

System.out.println("The value of sin is : " + sin);
System.out.println("The value of cos is : " + cos);
System.out.println("The value of tan is : " + tan);
System.out.println("The value of sec is : " + sec);
System.out.println("The value of cosec is : " + cosec);
System.out.println("The value of cot is : " + cot);

// Area of triangle using Heron's Formula
double s = (a + b + c) / 2;
double area = Math.sqrt(s * (s - a) * (s - b) * (s - c));
System.out.println("The area of triangle is : " + area);

}
}