用c语言,本关任务设圆半径,圆柱高,求圆周长c1半径为r的圆球表面积sp,圆半径r,圆柱高为h的圆柱体积vb用输入数据,输出计算结果,输出时取小数点后两位。为数字请编程序pi等于3.14
时间: 2023-05-30 17:05:27 浏览: 94
```c
#include <stdio.h>
int main() {
float pi = 3.14, r, h;
printf("请输入圆的半径和圆柱的高(用空格隔开):\n");
scanf("%f %f", &r, &h);
float c1 = 2 * pi * r;
float sp = 4 * pi * r * r;
float vb = pi * r * r * h;
printf("圆的周长为:%.2f\n", c1);
printf("半径为%.2f的圆球表面积为:%.2f\n", r, sp);
printf("半径为%.2f,高为%.2f的圆柱体积为:%.2f\n", r, h, vb);
return 0;
}
```
阅读全文