Expressions to calculate and display the circumference of a circle

image_pdfimage_print

   

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example3_1.cs illustrates the use of
  expressions to calculate and display
  the circumference of a circle
*/

public class Example3_1
{

  public static void Main()
  {

    const double Pi = 3.14159;
    double diameter = 2.5;

    // calculate the circumference
    double circumference = Pi * diameter;

    // display the circumference
    System.Console.WriteLine("Circumference = " + circumference);

  }

}