Finding Area Of Circle In C Programming
Here’s a C program that accepts the radius of a circle and calculates and prints its area:
#include
#define PI 3.14159
int main() {
float radius, area;
printf("Enter the radius of the circle: ");
scanf("%f", &radius);
area = PI * radius * radius;
printf("The area of the circle with radius %.2f is %.2f.\n", radius, area);
return 0;
}
Output

In this program, we declare a
radius
variable of typefloat
to store the input radius value, and anarea
variable of typefloat
to store the calculated area.The user is prompted to enter the radius of the circle using the
printf
function, and thescanf
function is used to read the input and store it in theradius
variable.To calculate the area of the circle, we use the formula
area = PI * radius * radius
, wherePI
is a constant defined with the value of 3.14159.Finally, the program displays the calculated area of the circle using
printf
with the%f
format specifier for floating-point values. The.2
in%.2f
specifies that the area should be displayed with two decimal places.