How to calculate area of a circle in c#
Object
Object
Write a program which takes
radius of a circle and calculates the area in case the value entered by the
user is non-zero positive integer. And it displays an error message otherwise.
Code
double
area;
int radius;
Console.WriteLine("\t\tFind
The Area OF Circle\n");
Console.Write("Enter
The Radius : ");
radius = int.Parse(Console.ReadLine());
if (radius > 0)
{
area = 3.14
* radius * radius;
Console.WriteLine("Area
is : " + area);
}
else
{
Console.WriteLine(".....error......");
}
No comments:
Post a Comment