Skip to content

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.14159 defines PI as a constant.
  • radius stores the radius entered by the user.
  • area = PI * radius * radius calculates the area.
  • %.2f displays the result up to 2 decimal places.