System.Math

This provides a core set of mathematical functions along with two constants: the ratio of the circumference of a circle to its diameter (pi) and the natural logarithm base (e). Listing B.14 provides an example of using parts of the Math class (math.cs).

Listing B.14. Math Example
static void Main(string [] args)
{
    Console.WriteLine("Pi: {0} ", Math.PI);
    Console.WriteLine("E: {0} ", Math.E);
    Console.WriteLine("sqrt(2): {0} ", Math.Sqrt(2.0));
    Console.WriteLine("log(e): {0} ", Math.Log(Math.E));
    Console.WriteLine("cos(pi): {0} ", Math.Cos(Math.PI));
    Console.WriteLine("sin(pi): {0} ", Math.Sin(Math.PI));
    Console.WriteLine("2^5: {0} ", Math.Pow(2,5));
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.43