Use expressions to calculate and display the circumference of a circle : Const : Class C# Examples


C# Examples » Class » Const »

 

Use expressions to calculate and display the circumference of a circle









    
class  MainClass
{

    public  static  void  Main()
    {

        const  double  Pi  =  3.14159;
        double  diameter  =  2.5;

        double  circumference  =  Pi  *  diameter;

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

    }

}
    
   
  
   



Output

Circumference = 7.853975


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Const