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);

`}`

advertisement

$ 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.**

advertisement

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

If you wish to look at other example programs on Mathematical Functions, go to C Programming Examples on Mathematical Functions. If you wish to look at programming examples on all topics, go to C Programming Examples.