Q:

C# program to demonstrate the use of PI property of Math class

0

C# program to demonstrate the use of PI property of Math class

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to demonstrate the use of PI property of Math class (In this program, we are going to calculate the area of circle using the PI property.) is given below. The given program is compiled and executed successfully.

using System;

class Sample
{
    //Entry point of Program
    static public void Main()
    {
        double AreaOfCircle = 0.0;
        int radius = 12;

        AreaOfCircle = (Math.PI * radius * radius);

        System.Console.WriteLine("Area of Circle: "+AreaOfCircle);
    }
}

Output:

Area of Circle: 452.38934211693
Press any key to continue . . .

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now