C++ Program to Find Area and Circumference of a Circle

In this C++ program, we will calculate circumference and area of circle given radius of the circle.
The area of circle is the amount of two-dimensional space taken up by a circle. We can calculate the area of a circle if you know its radius. Area of circle is measured in square units.

Area of Circle = PI X Radius X Radius.
Where, Where PI is a constant which is equal to 22/7 or 3.141(approx)
C++ program to find area of a circle

C++ Program to Find Area of Circle

// C Program to calculate area of a circle

#include <iostream>
using namespace std;
 
#define PI 3.141
 
int main(){
    float radius, area;
    cout << "Enter radius of circle\n";
    cin >> radius;
    // Area of Circle = PI x Radius X Radius
    area = PI*radius*radius;
    cout << "Area of circle : " << area;
     
    return 0;
}
Output
Enter radius of circle
7
Area of circle : 153.909

In above program, we first take radius of circle as input from user and store it in variable radius. Then we calculate the area of circle using above mentioned formulae and print it on screen using cout.


C++ Program to Find Circumference of Circle

Circumference of circle is the length of the curved line which defines the boundary of a circle. The perimeter of a circle is called the circumference.
We can compute the circumference of a Circle if you know its radius using following formulae.

Circumference or Circle = 2 X PI X Radius

We can compute the circumference of a Circle if you know its diameter using following formulae.

Circumference or Circle = PI X Diameter

// C Program to calculate circumference of a circle

#include <iostream>
using namespace std;
 
#define PI 3.141
 
int main(){
    float radius, circumference;
    cout << "Enter radius of circle\n";
    cin >> radius;
    // Circumference of Circle = 2 X PI x Radius
    circumference = 2*PI*radius;
    cout << "Circumference of circle : " << circumference;
     
    return 0;
}
Output
Enter radius of circle
7
Circumference of circle : 43.974

In above program, we first take radius of circle as input from user and store it in variable radius. Then we calculate the circumference of circle using above mentioned formulae and print it on screen using cout.