Write a c sharp program that computes the circumstance and area of a circle. Declare pi as constant with value of 3.1416.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Q176923
{
class Program
{
static void Main(string[] args)
{
//Declare pi as constant with value of 3.1416.
double PI = 3.1416;
double radius;
//read radius
Console.Write("Enter radius: ");
radius = double.Parse(Console.ReadLine());
// compute the circumstance and area of a circle.
double circumstance=2*radius*PI;
double area=radius*radius*PI;
// Display the circumstance and area of a circle.
Console.WriteLine("The circumstance of circle: {0}",circumstance);
Console.WriteLine("The area of circle: {0}",area);
Console.ReadLine();
}
}
}
Comments
Leave a comment