Expressions to calculate and display the circumference of a circle : Expressions : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Expressions »

 

Expressions to calculate and display the circumference of a circle









    

/*
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);

  }

}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Expressions