Swift Double squareRoot()

The squareRoot() method returns the square root of the given value.

Example


squareRoot() Syntax

The syntax of the double squareRoot() method is:

num.squareRoot()

Here, num is the number whose square root is to be calculated.


squareRoot() Parameters

The squareRoot() method doesn't take any parameter.


squareRoot() Return Values

  • returns the square root of the num.

Example: Swift Double squareRoot()

Output

3.0
7.395944834840239
0.0

In the above example, we have used the squareRoot() method to find the square root of the given numbers.