## #1,101 – Mathematical Constants

May 21, 2014 2 Comments

For your convenience, the **System.Math** class provides two useful mathematical constants, as fields.

**Math.E –**base of the natural logarithm, or Euler’s Number**e**, with value of approximately 2.71828**Math.PI**– ratio of circle’s circumference to its diameter**π,**with value of approximately 3.14159

If you need to use either of these constants in your code, you can use the corresponding field in the **Math** class.

double radius = 5.0; double circumference = 2.0 * Math.PI * radius; Console.Write("Radius={0}, Circumference={1}", radius, circumference);

Advertisements