Friday, March 7, 2014

Maths Class

Click Here - Array Class , String Class , Math Class , Random Class

Math Class

The System.Math class offers  some  pre-defined  methods  related  to  mathematical operations.Math is a static class. So, all of the methods of Math class are static methods, so that you can access them without creating any object. Here, you can see the available methods of Math class in this table:

Program for Math Class


namespace App_47_Maths_Class
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Math.Abs(-84));
            Console.WriteLine(Math.Pow(10, 3));
            Console.WriteLine(Math.Min(5, 100));
            Console.WriteLine(Math.Max(5, 100));
            Console.WriteLine(Math.Min(25, Math.Min(78, 87)));
            Console.WriteLine(Math.Max(25, Math.Max(78, 87)));
            Console.WriteLine(Math.Sqrt(9));
            Console.WriteLine(Math.Floor(10.56));
            Console.WriteLine(Math.Ceiling(10.56));
            Console.WriteLine(Math.Round(10.56));
            Console.WriteLine(Math.Round(10.23));
            Console.WriteLine(Math.Round(10.2342, 2));
            Console.WriteLine(Math.Round(10.2392, 2));
            Console.WriteLine(Math.Sign(10));
            Console.WriteLine(Math.Sign(-10));
            Console.WriteLine(Math.PI);
            Console.Read();
        }
    }
}

Download above code for Demo of  Maths Class : Download Links


Click Here - Array Class , String Class , Math Class , Random Class