# C Program to Find Circumference of Circle

In this post, we will learn how to find the circumference of a circle using C Programming language.

The circumference of a circle is its boundary or the length of the complete arc of the circle.

The circumference of the circle can be calculated using the formula 2πr, where ‘r‘ is the radius of the circle and π = 3.14.

We will be finding the circumference of the circle by using the following methods:

1. Using Standard Method
2. Using User-defined Function

So, without further ado, let’s begin this tutorial.

Contents

## C Program to Find Circumference of Circle

```// C Program to Find Circumference of Circle
#include <stdio.h>
int main(){
float radius, PI = 3.14, cf;

printf("Enter the radius of the circle: ");

// Circumference
cf = 2 * PI * radius;

// Display output
printf("Circumference of Circle: %.2f", cf);
return 0;
}
```

Output

``````Enter the radius of the circle: 21
Circumference of Circle: 131.88
``````

## How Does This Program Work ?

```    float radius, PI = 3.14, cf;
```

In this program, we have declared three float data type variables named radius, Pi and cf.

```    // Asking for input
printf("Enter the radius of the circle: ");
```

Then, the user is asked to enter the radius of the circle.

```    // Circumference
cf = 2 * PI * radius;
```

We calculate the circumference of the circle using the formula 2πr. The value of circumference gets stored in the cf named variable.

```    // Display output
printf("Circumference of Circle: %.2f", cf);
```

Finally, the result is displayed on the screen using printf() function. Here, we have used %.2f format specifier because we want to display the result only till 2 decimal places.

## C Program to Find Circumference of Circle Using Function

```// C Program to Find Circumference of Circle Using Function
#include <stdio.h>
return 2 * 3.14 * radius;
}

int main(){

printf("Enter the radius of the circle: ");

// Finding circumference

// Displaying output
printf("Circumference of the Circle: %.2f", cf);
return 0;
}
```

Output

``````Enter the radius of the circle: 7
Circumference of the Circle: 43.96
``````
```float circumference(int radius){
return 2 * 3.14 * radius;
}
```

In this program, we have defined a custom function named circumference which returns the circumference of the circle.

```    // Finding circumference