Trigonometric Functions in Java


Description : They are used to find sine, cosine and tangent values respectively of a given angle(in radians).

☞If you want to find the value of any angle, then convert it into radians and pass it as a agrument.

Formula to convert degree into radian : R(radian) = degree * pi/180

Return Data Type : It returns double type value.

Syntax : <return_data_type> <variable_name> = Math.sin/cos/tan(argument in radian);

Example

public class TrigonometricExample {
    public static void main(String[] args) {
        
        int angle=0;
        double radian=angle*22/7.0/180;
        System.out.println(Math.sin(radian));
        System.out.println(Math.cos(radian));
        
    }
}

Output

0.0
1.0