# C Program to Calculate Area and Circumference of Circle

In this article, you will learn and get code about calculating area and circumference of a circle.

To calculate area or circumference of any circle in C programming, you have to ask from user to enter the radius of circle say r. Using this radius, to find area, use 3.14*r*r. And to find circumference, use 2*3.14*r. Here 3.14 is the value of π (Pi)

List of programs, available here in this article:

• Find Area of Circle
• Find Area of Circle using Function
• Find Circumference of Circle
• Find Circumference of Circle using Function

## Calculate Area of Circle in C

As area of any circle can be calculated using the formula πr2. Here r represents radius of circle, and the value of π (Pi) is equal to 3.14. So the formula can be written as 3.14r2 or 3.14*r*r. Let's take a look at the program:

```#include<stdio.h>
#include<conio.h>
int main()
{
printf("Enter Radius Value of Circle: ");
printf("\nArea = %0.2f", area);
getch();
return 0;
}```

This program was written under Code::Blocks IDE. Here is the first snapshot of sample run:

Now supply any number as radius value of circle say 5 and press ENTER key to see the output as shown in the second snapshot of sample run:

The format specifier, %0.2f is used to print the value of area upto only two decimal place.

## Calculate Area of Circle using Function in C

Let's create another program that does the same job but using function as shown here:

```#include<stdio.h>
#include<conio.h>
float findArea(float);
int main()
{
printf("Enter Radius Value of Circle: ");
printf("\nArea = %0.2f", area);
getch();
return 0;
}
{
}```

After compiling and executing the above program, you will get the same output as seen from the first program's output. To learn more about function, refer to Function in C tutorial.

## Calculate Circumference of Circle in C

As circumference of a circle can be calculated using the formula 2πr. Here the value of π is 3.14, and r represents radius of circle. Therefore, after putting the value of π, the formula becomes 2*3.14*r. Here is the program to find circumference of circle:

```#include<stdio.h>
#include<conio.h>
int main()
{
float r, circumf;
printf("Enter Radius Value of Circle: ");
scanf("%f", &r);
circumf = 2*3.14*r;
printf("\nCircumference = %0.2f", circumf);
getch();
return 0;
}```

Here is the sample run of above program:

## Calculate Circumference of Circle using Function in C

Now let's create another program that does the same job as of previous program, but this time using function.

```#include<stdio.h>
#include<conio.h>
float findCircumf(float);
int main()
{
float r, circumf;
printf("Enter Radius Value of Circle: ");
scanf("%f", &r);
circumf = findCircumf(r);
printf("\nCircumference = %0.2f", circumf);
getch();
return 0;
}
float findCircumf(float r)
{
return 2*3.14*r;
}```

This program produce the same output as seen from previous program's output.

#### Same Program in Other Languages

C Online Test

« Previous Program Next Program »

Like/Share Us on Facebook 😋