# C Program to find Diameter, Circumference, and Area Of a Circle

How to write a C Program to find Diameter, Circumference, and Area Of a Circle using Functions with example?. The mathematical formulas behind these calculations are:

1. Diameter of a Circle = 2r = 2 * radius
2. Circumference of a Circle = 2πr = 2 * π * radius
3. Area of a circle is: A = πr² =  π * radius * radius

## C Program to find Diameter, Circumference, and Area Of a Circle

This program allows the user to enter the radius of a circle. Using that radius value, it will find the Diameter, Circumference, and Area Of a Circle

TIP: Please refer C Program to Calculate Area Of a Circle article to understand the various C Programming ways to calculate the Area of a Circle.

```/* C Program to find Diameter, Circumference, and Area Of a Circle */

#include<stdio.h>

#define PI 3.14

int main()
{

circumference = 2 * PI * radius;

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

return 0;
}```

## C Program to find Diameter, Circumference, and Area Of a Circle using Functions

In this program, we are using Functions that find the Diameter, Circumference, and Area Of a Circle. Remember, you have to include math.h library to use M_PI. Otherwise, manually define PI value as we did in the first example.

```/* C Program to find Diameter, Circumference, and Area Of a Circle */

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

int main()
{

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

return 0;
}

{
}

{
}
{
}```

From the above code snippet, you can see we created three functions

• double find_Diameter(double radius) function to calculate the Diameter of a circle
• double find_Circumference(double radius) function to calculate the Circumference of a circle
• And double find_Area(double radius) function to find the Area of a circle
• Next, we called those functions in the main() program to calculate those values

When the compiler reaches to the above-specified functions in the main() program, the compiler will immediately jump to their respective function definitions.

`````` Please Enter the radius of a circle : 10

Diameter Of a Circle = 20.00
Circumference Of a Circle = 62.83
Area Of a Circle = 314.16``````