Home >Backend Development >C++ >In C programming, find the area of a circle
A circle is a closed shape. All points on a circle are equidistant from a point inside the circle. The center point is called the center of the circle. The distance from a point to the center of a circle is called the radius.
Area is a quantitative representation of the size span of a closed figure.
The area of a circle is the area enclosed within the dimensions of the circle.
Formula to calculate the area of a circle,
Area = π*r*r
To calculate the area, we are given the radius of the circle as input, we will use the formula to calculate the area,
STEP 1: Take radius as input from the user using std input. STEP 2: Calculate the area of circle using, area = (3.14)*r*r STEP 3: Print the area to the screen using the std output.
int r, the radius of the circle
float area, the area of the circle calculated using the formula. p>
Live demonstration
#include <stdio.h> int main(){ int r = 8; float area = (3.14)*r*r; printf("The area of the circle is %f",area); return 0; }
The area of the circle is 200.96
The above is the detailed content of In C programming, find the area of a circle. For more information, please follow other related articles on the PHP Chinese website!