Home > Backend Development > C++ > In C programming, find the area of ​​a circle

In C programming, find the area of ​​a circle

WBOY
Release: 2023-08-25 22:57:10
forward
1321 people have browsed it

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
Copy after login

To calculate the area, we are given the radius of the circle as input, we will use the formula to calculate the area,

Algorithm

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.
Copy after login

Example

Variables used -

int r, the radius of the circle

float area, the area of ​​the circle calculated using the formula.

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;
}
Copy after login

Output

The area of the circle is 200.96
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template