In this article, we will write a C program to find the area of circle using function.

The program takes the radius of the circle from the user as input and prints the circle’s area as an output on the screen.

**Sample Input:**

`Enter the Radius of the Circle: 2`

**Output:**

`The Area of the Circle is: 12.560000`

The formula of a circle having radius **r** is given by:

Where π is a constant having a value of 22/7 or 3.14

The following program shows how you can calculate the area of a circle using a function in C programming language:

// C program to calculate the area of a circle #include <stdio.h> // User defined function to calculate circle's area float getCircleArea(float radius){ const float PI = 3.14; float area; // Calculate the area area = PI * radius * radius; return area; // Return the area } int main(){ // Declare the variables float radius, circleArea; printf("Enter the Radius of the Circle: "); scanf("%f", &radius); // call the function circleArea = getCircleArea(radius); // Print the result printf("The Area of the Circle is: %f", circleArea); return 0; }

**Output:**

Enter the Radius of the Circle: 2 The Area of the Circle is: 12.560000

### Code Explanation:

- The program asks the user to input the radius of the circle which is stored in the
`radius`

variable. - To calculate the area of the circle, we call the
`getCircleArea()`

function which takes the radius of the circle as an argument and returns the calculated area. - The value returned by the
`getCircleArea()`

function is stored in the`circleArea`

variable. - Finally, the area of the circle is printed on the screen using the printf() function.

Thanks for reading.