C# Math

Last modified: July 11, 2021
Math.Max(x,y)

Return the maximum of 7 0r 10

var max = Math.Max(7, 10); //output 10
Math.Min(x,y)

Return the minimum of 2 0r 10

var min = Math.Min(2, 10); //output 2
Math.Sqrt(x)
Return the square root of 5 var squareRoot = Math.Sqrt(5); //output 2.23606797749979
Math.Round(x)

Return the rounding of 5.999

var round = Math.Round(5.999); //output 6
Math.Abs(x)

Return the positive value -5.999

var abs = Math.Abs(-5.999); // 5.999
Math.Abs(x,y)

Return power of 2 to 3

var pow = Math.Pow(2, 3); //ouput 8