Back to: C#.NET Programs and Algorithms

**Area of Circle Program in C# with Examples**

In this article, I am going to discuss **how to calculate the Area of a Circle in C#** with Examples. Please read our previous article, where we discussed the **Area of Triangle Program in C#**. Here, in this article, first, we will discuss what is Circle, then we will discuss how to calculate the area of a circle and finally, we will see how to implement the area of circle program in C#.

**What is a Circle?**

A circle is a round-shaped figure that has no corners or edges. It has the set of all points on a plane that are a fixed distance from the center. Or, in geometry, a circle can be defined as a closed, two-dimensional curved shape.

**How to calculate the area of a Circle?**

Following is the formula to calculate the area of the Circle.

Area of a circle( **A) = π * r * r**

where r is the radius of the circle.

A is the area of the Circle

π is the constant value I.e. (22/7 or 3.14)

r=d/2; i.e. If d=4 given then radius=2

**Example:**

Input: r=7

Area of a circle= π * r * r

= (22/7) *7*7

=154

In this program, we are going to use the following data type and constants.

**Double**: Double is also a data type that is used to represent the floating-point numbers. It has 15 decimal digits of precision. Example: double y = 4244.546**Float:**Floating-point numbers are used for decimal and exponential values. It is a primitive data type. It has 6 decimal digits of precision. Example: float n2 = 5.5**PI**: pi is a constant variable that value is 3.14. It is used for mathematical calculation. Example: Pi=3.14(decimal form) and Pi=22/7(fraction form)

**Logic to Calculate the Area of Circle in C# **

To find the area of Circle, we need to follow the below steps.

- First, we will take variable radius(r).
- Then we will constant variable pi.
- After that, we will calculate the area of the circle by using the formula: π * r * r
- And the result will be store in the area variable.

**Example: Area of Circle Program in C#.**

The following C# Program will calculate the area of the Circle.

using System; class Circle { static void Main(string[] args) { Console.Write("Enter Radius: "); double Radious = Convert.ToDouble(Console.ReadLine()); double Area = Math.PI * Radious * Radious; Console.WriteLine("Area of circle: " + Area); Console.ReadKey(); } }

**Output:**

Here radius of the circle will change according to user input.

In the next article, I am going to discuss how to find the **Area of Cube in C#** with Examples. Here, in this article, I try to explain how to calculate the** Area of a Circle in C# with Examples** and I hope you enjoy this Area of Circle Program article.

**About the Author: Pranaya Rout**

Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.