Skip to main content

Circumference of Circle C++ Example Program in C++

1 min read Updated June 30, 2026
Share:
On this page (7sections)

About this program

This is an example program in c common example program. Read the concept first: C++ Variables and Data Types, 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 In C++*/
/*## Calculation C++ Programs, Datatype C++ Programs, Basic C++ Programs*/

#include <iostream>
#include<conio.h>
#include<stdlib.h>

using namespace std;

float PI = 3.14;

int main() {
   // Declare Variables
   float radius, ci;

   cout << "Simple C++ Program : Circumference Of Circle\n";
   cout << "\nEnter the radius of Circle : ";
   cin>>radius;

   ci = 2 * PI * radius;

   cout << "\nCircumference of Circle : " << ci;

   getch();
   return (0);
}

Sample Output

Simple C++ Program : Circumference Of Circle

Enter the radius of Circle : 5

Circumference of Circle : 31.4

Learn the concept first, then study the code:

Frequently Asked Questions

What does this C++ program do?
It is a C++ example program that demonstrates Circumference of Circle, including the complete source code and the expected sample output.
How do I compile and run this C++ program?
Save the code in a `.cpp` file, compile it with `g++ filename.cpp -o program`, then run it with `./program` (or `program.exe` on Windows).
What concepts does this example use?
This example uses reading user input, illustrating a common pattern in C++ programming.

Related Tutorials

Search tutorials