C# Math Sqrt
Description
Math Sqrt
returns the square root of a specified number.
Syntax
Math.Sqrt
has the following syntax.
public static double Sqrt(
double d
)
Parameters
Math.Sqrt
has the following parameters.
d
- The number whose square root is to be found.
Returns
Math.Sqrt
method returns One of the values in the following table. d parameter Return value Zero or
positive The positive square root of d. Negative NaN Equals NaN NaN Equals
PositiveInfinity PositiveInfinity
Example
The following code shows how to use Math.Sqrt method.
using System;/*from w w w.j a va 2 s. c o m*/
public class MainClass{
public static void Main(String[] argv){
System.Console.WriteLine(Math.Sqrt(0.5));
}
}
The code above generates the following result.