## C program to find the area of a circle

In this program, we are going to discuss how to calculate the area of a circle in c. so let’s start!

Example –

**Input –**

So first step we are going to take input from the user so we take the radius as 12.

**Logic-**

To calculate the area of the circle you must know the formula to calculate the area of the circle that is :

Area = 3.14 * r * r;

**Output-**

Enter the radius of the circle:22

The area of a circle is 1519.760010

**Method 1:**

So let us start to implement this formula in our program.

#include<stdio.h>

int main()

{

int radius;

float area;

printf(“Enter the radius of the circle: “);

scanf(“%d”, &radius);

area = 3.14 * radius * radius;

printf(“The radius of the circle is %f”, area);

return 0;

}

**Output**

Enter the radius of the circle: 12

The radius of the circle is 452.160004

**Method 2 – by using the function**

#include<stdio.h>

float area(int radius){

float area;

area = 3.14 * radius *radius;

return area;

}

int main()

{

int radius;

printf(“Enter the radius of the circle:”);

scanf(“%d”, &radius);

printf(“The area of the circle is %f”, area(radius));

return 0;

}

**Output**

Enter the radius of the circle:2

The area of the circle is 12.560000

In the first method, we simply calculate the area of a triangle by using a simple method in the second method we calculate the area of a triangle by using the function, I hope these programs are helpful to you to understand the concept to calculate the area of a triangle.