logo image

C++ program to calculate circle area

Views: 13

Following program shows you how to calculate circle area. In this tutorial will get circle radius from user and calculate area and prints it using following formula Area = PI X r X r

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

int main() {
	float circleRadius;

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

	float areaOfCircle = 22 / 7 * (circleRadius * circleRadius);

	std::cout << "Area of circle is: " << areaOfCircle;
}

Output:

Please enter the radius of circle: 12
Area of circle is: 432