CSharp - Essential Types Math Type

Introduction

The following table lists the members of the static Math class.

The trigonometric functions accept arguments of type double.

Other methods such as Max are overloaded to operate on all numeric types.

The Math class also defines the mathematical constants E (e) and PI.

Category
Methods
Rounding
Round, Truncate, Floor, Ceiling
Maximum/minimum
Max, Min
Absolute value and sign
Abs, Sign
Square root
Sqrt
Raising to a power
Pow, Exp
Logarithm
Log, Log10
Trigonometric


Sin, Cos, Tan
Sinh, Cosh, Tanh
Asin, Acos, Atan

Demo

using System;
class MainClass//from  w  ww .ja va2  s. c om
{
   public static void Main(string[] args)
   {
       Console.WriteLine(Math.Round(3.7));
   }
}

Result

Exercise