C Program to Find the Area of a Circle Using PI as a Constant
Formula: Area = π × r²
#include <stdio.h>
#define PI 3.14159
int main()
{
float radius, area;
printf(“Enter radius of circle: “);
scanf(“%f”, &radius);
area = PI * radius * radius;
printf(“Area of circle = %.2f”, area);
return 0;
}
Explanation:
#define PI 3.14159defines PI as a constant.radiusstores the radius entered by the user.area = PI * radius * radiuscalculates the area.%.2fdisplays the result up to 2 decimal places.