Circumference of Circle Example in C
On this page (6sections)
About this program
This is an example program in c calculation programs. Read the concept first: Data Types in C Programming, then study the code and output below.
Definition
When a circle’s diameter is 1, its circumference is π. When a circle’s radius is 1—called a unit circle—its circumference is 2π.
Formula
The circumference of a circle is written
π = C / d
Or, equivalently, as the ratio of the circumference to twice the radius. The above formula can be rearranged to solve for the circumference:
C = π * d = 2π * r
here,
r = Radius
π = ~3.14
Circumference Of Circle Example Program
/*##Circumference Of Circle*/
/*##Calculation Programs, Datatype Programs, Basic Programs*/
#include<stdio.h>
float PI = 3.14;
int main(){
float radius, ci;
printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);
ci = 2 * PI * radius;
printf("\nCircumference of Circle : %f", ci);
return (0);
}
Sample Output
Enter the radius of Circle : 2
Circumference of Circle : 12.560000
Related Pages
Learn the concept first, then study the code:
- C Programs — Browse all C Programs.
- Data Types in C Programming — Concept — int, float, double and format specifiers.
- Area Of Circle Example C Program — More in c calculation programs.
- Area Of Square Example C Program — More in c calculation programs.