Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

C# - Defining Constants

using System;

namespace DeclaringConstants {

    class Program {
    
        static void Main(string[] args) {
            const double pi = 3.14159;   
            
            // constant declaration 
            double r=6;
            Console.WriteLine("Enter Radius: ");
           r = Convert.ToDouble(Console.ReadLine());
            double areaCircle = pi * r * r;
            Console.WriteLine("Radius: {0}, Area: {1}", r, areaCircle);
            Console.ReadLine();
        }
    }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.