在C编程中,找到一个圆的面积

WBOY
WBOY 转载
2023-08-25 22:57:10 929浏览

在C编程中,找到一个圆的面积

圆是封闭图形。圆上的所有点到圆内一点的距离都相等。中心点称为圆心。点到圆心的距离称为半径。

面积是封闭图形尺寸跨度的定量表示。

圆的面积是圆的尺寸内包围的面积。

计算圆面积的公式,

Area = π*r*r

为了计算面积,我们给出了圆的半径作为输入,我们将使用公式来计算面积,

算法

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,圆的半径

float area,使用公式计算的圆面积。 p>

现场演示

#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

以上就是在C编程中,找到一个圆的面积的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除