Computer Applications

Explain Java function Math.sqrt( ) with an example.

Input in Java

3 Likes

Answer

This function is used to find the square root of a positive number. It will always return a double type value.

Syntax

<Return data type><variable> = Function name (Positive number);

double <variable> = Math.sqrt(arg);

For example, consider the statement

double n = Math.sqrt(25);

It will return a double type value for n as 5.0.

Answered By

1 Like


Related Questions