This is a C Program to calculate the area of a circle.

This C Program calculates the area of a Circle given it’s radius.

The formula to calculate the area is: Area = π × r2 where r is the radius of the circle & π value is 22/7.

Here is source code of the C program to calculate the area of a circle. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

/* * C program to find the area of a circle, given the radius */ #include <stdio.h> #include <math.h> #define PI 3.142 void main() { float radius, area; printf("Enter the radius of a circle \n"); scanf("%f", &radius); area = PI * pow(radius, 2); printf("Area of a circle = %5.2f\n", area); }

In this C program, library function defined in <math.h> header file is used to compute mathematical functions. We are reading the radius of a circle using ‘radius’ variable. To find the area of a circle, the following formula is used.

Area = PI * pow (radius, 2)

$ cc pgm2.c -lm $ a.out Enter the radius of a circle 30 Area of a circle = 2827.80

**Sanfoundry Global Education & Learning Series – 1000 C Programs.**

Here’s the list of Best Reference Books in C Programming, Data-Structures and Algorithms