toDegrees() in Java

toDegrees(): This method is available in the Math class of Java.

Syntax:

double java.lang.Math.toDegrees(double angrad)

This method takes one argument of type double as its parameter. It converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Parameters: One parameter is required for this method.

angrad: an angle, in radians

Returns: the measurement of the angle angrad in degrees.

For Example:

Math.toDegrees(3.14) = > It returns 179.9087476710785

Approach

Java

public class Todegrees {
    public static void main(String[] args) {

        double angrad = 3.14;
        System.out.println(Math.toDegrees(angrad));

    }
}

Output:

179.9087476710785

No comments:

Post a Comment