Write a program to calculate the area of a circle and display the reuslt. Use the formula: a=πr^2 where Pi is approximately equal to 3.1416
using System;
namespace App
{
class Program
{
static void Main(string[] args)
{
const double PI = 3.1416;
Console.Write("Enter a radius of a circle: ");
double r = Convert.ToDouble(Console.ReadLine());
double area = PI * r * r;
Console.WriteLine("The area of a circle = {0}", area);
Console.ReadLine();
}
}
}
Comments
Leave a comment