# C Program to Calculate Area Of a Circle

How to write C Program to Calculate the Area Of a Circle with an example?. Before we step into the program, Let’s see the definitions and formulas behind this.

The area of a circle is the number of square units inside the circle. The standard formula to calculate the area of a circle is A=πr².

## C Program to Calculate Area Of a Circle using Radius

If we know the radius, then we can calculate the area of a circle using the formula: A=πr² (Here, A is the area of the circle, and r is the radius).

In this C program to find the area of a circle, we allow the user to enter the radius, and We define pi as a global variable and assign the value as 3.14. Next, this program will find the area and circumference of a circle as per the formula.

```#include<stdio.h>

#define PI 3.14

int main()
{

printf("\n Area Of a Circle = %.2f\n", area);
printf("\n Circumference Of a Circle = %.2f\n", circumference);

return 0;
}```

output

`````` Please Enter the radius of a circle
6

Area Of a Circle = 113.04

Circumference Of a Circle = 37.68``````

## C Program to Calculate Area Of a Circle using Circumference

The distance around the circle is called the circumference. If you know the circumference, we can calculate the area of a circle using the formula: A= C²⁄ 4π. Here C is the circumference.

```#include <stdio.h>
#include <math.h>

int main()
{
float area, circumference;

printf("\n Please Enter the Circumference of a circle \n");
scanf("%f", &circumference);

/* We can use M_PI instead of defining PI
area = (circumference * circumference) /(4* M_PI);

printf("\n Area Of Circle = %.2f\n", area);
return 0;
}```

In this program, we included one more header file called <math.h>, It allows using pi without declaring it. This program allows the user to enter the value of the circumference. Then this C Program will find the area of a circle as per the formula.

`````` Please Enter the Circumference of a circle
26

Area Of Circle = 53.79``````

### C Program to Calculate Area Of a Circle using Diameter

The distance across the circle passes through the center, called diameter. If we know the diameter, we can calculate the area of a circle using the formula: A=π/4*D² (D is the diameter)

```#include<stdio.h>

main()
{
float PI = 3.14;

printf("\nPlease Enter the Diameter of a circle\n");
scanf("%f", &diameter);

area1 = (PI/4)* (diameter*diameter);

printf("\nArea of Circle using direct formula = %.2f\n", area1);
printf("\nArea of Circle Using Method 2 = %.2f\n", area2);

return 0;
}```

This c program to find the area of a circle allows the user to insert the diameter value. Then it calculates the area of a circle as per the formula we shown above.

We also mentioned other approaches.