C# – Return Area and Circumference of Circle

email me

using System;

class Program
{
public static void Main()
{
double r_cir, per_cir, PI, area_cir;

Console.Write("Enter radius of circle: ");

r_cir = Convert.ToDouble(Console.ReadLine());

PI = Math.Pow(Math.PI, 1);
area_cir = Math.Round(PI * Math.Pow(r_cir, 2), 2);
per_cir = Math.Round(2 * PI * r_cir, 2);

Console.WriteLine("\nCircumference of circle: {0}", per_cir);
Console.WriteLine("Area of circle: {0}", area_cir);

Console.Read();
}
}

 

Output

 

Notes

Convert.ToDouble

Math.PI

Math.Pow

 

tags: circumference, radius, mathematics, MrNetTek