C++ program to calculate circle circumference

Views: 119   

Following program shows you how to calculate circle circumference.
In this program we get circle radius from user and calculate circumference using following formula
Circumference = 2 X PI X r

#include <iostream>
#include <math.h>

int main() {
    float circleRadius;

    std::cout << "Please enter the radius of circle:";
    std::cin >> circleRadius;

    float circumferenceOfCircle = 2 * 3.14 * circleRadius;

    std::cout << "Circumference of circle is: " << circumferenceOfCircle;


Please enter the radius of circle: 8
Circumference of circle is: 50.24
On By