C# program to calculate the area and circumference of a circle
Program.cs
double r, AREA;
const double PI = 3.14;    
Console.WriteLine("———————————————————————————————————————————");
Console.WriteLine("Program to calculate the area and circumference of a circle");
Console.WriteLine("———————————————————————————————————————————");
Console.Write("Enter the radius of circle ");
r = Convert.ToDouble(Console.ReadLine());
AREA = PI * r * r;
Console.WriteLine("\nThe area of circle is {0} when radius is {1}", AREA, r);
Console.WriteLine("\nThe circumference of circle is {0}", 2 * PI * r);          
Console.WriteLine("———————————————————————————————————————————");
Output
kodingwindow@kw:~/csharp$ dotnet run
———————————————————————————————————————————
Program to calculate the area and circumference of a circle
———————————————————————————————————————————
Enter the radius of a circle 10

The area of a circle is 314 when radius is 10

The circumference of a circle is 62.8
———————————————————————————————————————————
kodingwindow@kw:~/csharp$ 
Advertisement