How to Calculate Trigonometric Cosine of an Angle in Java


Here this example will explain how to calculate trigonometric cosine of an angle with Math.cos(45)in Java.

Source Code

package com.beginner.examples;

public class CosineExample {

    public static void main(String[] args){
    	//return the trigonometric cosin value of an angle.
        System.out.println("cos(45) is: "+Math.cos(45));
        System.out.println("cos(60) is: "+Math.cos(60));
    }
}

Output:

cos(45) is: 0.5253219888177297
cos(60) is: -0.9524129804151563
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments