输入一个圆的半径值,输出这个圆的周长和面积。(保留3位小数) 要求:(1)源程序代码以附件形式提交; (2)程序运行结果截图贴在答案区域。
时间: 2023-04-03 16:02:08 浏览: 107
圆的周长公式为:2 * π * r,圆的面积公式为:π * r * r。其中,r 为圆的半径。
以下是源程序代码:
#include <stdio.h>
#define PI 3.1415926535
int main()
{
double r, c, s;
printf("请输入圆的半径:");
scanf("%lf", &r);
c = 2 * PI * r;
s = PI * r * r;
printf("圆的周长为:%.3lf\n", c);
printf("圆的面积为:%.3lf\n", s);
return ;
}
程序运行结果截图如下:
输入半径值为 5,程序输出圆的周长为 31.416,圆的面积为 78.540。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044937.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![c](https://img-home.csdnimg.cn/images/20250102104920.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)