I wrote this simple program to ask the user to give radius of the circle and then program will compute the area of the circle using C# programming language.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
Program.cs
using System;
namespace Area_of_Circle
{
class Program
{
// Area of the circle in C#
// Jake Rodriguez Pomperada,MAED-IT, MIT
// www.jakerpomperada.com
// www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines
static void Main(string[] args)
{
double radius, area;
Console.WriteLine("\n\n");
Console.WriteLine("\tArea of the Circle in C#");
Console.WriteLine("\n");
Console.Write("\tEnter Radius: ");
radius = Convert.ToDouble(Console.ReadLine());
area = Math.PI * radius * radius;
Console.WriteLine("\n");
Console.WriteLine("\tArea of circle: {0:0.##} " , area);
Console.WriteLine("\n");
Console.WriteLine("\tEnd of Program");
Console.ReadKey();
}
}
}
No comments:
Post a Comment