c# math.sqrt() method example

C#
[Edit]
+
0
-
0

C# Math.Sqrt() method example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
using System; public class Program { public static void Main(string[] args) { Console.WriteLine( Math.Sqrt( 4 ) ); // 2 Console.WriteLine( Math.Sqrt( 9 ) ); // 3 Console.WriteLine( Math.Sqrt( 2 ) ); // 1.4142135623730951 Console.WriteLine( Math.Sqrt( 0.5 ) ); // 0.7071067811865476 Console.WriteLine( Math.Sqrt( 0 ) ); // 0 Console.WriteLine( Math.Sqrt( -1 ) ); // NaN } }