c语言:设圆半径r=3,圆柱体高为h=12.5,求圆周长,圆面积,圆柱体积。用scanf()输入数据

,输出计算结果,取小数点后2位小数,请编程序

#include<stdio.h>
#define PI 3.14
int main(void)
{
float r,h;
printf("请输入该圆柱体的半径\n:");
scanf("%f",&r);
printf("请输入该圆柱体的高\n:");
scanf("%f",&h);
printf("该圆柱体底面周长是:%f\n",2*PI*r);
printf("该圆柱体底面面积是:%f\n",PI*r^2);
printf("该圆柱体体积是:%f\n",PI*r^2*h);
return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2018-04-24
#include <stdio.h>
#include <stdlib.h>
#define PI 3.1415
int main()
{
float r,h,c,s,v;
scanf("%f %f",&r,&h);
c=2*PI*r;
s=PI*r*r;
v=s*h;
printf("%.2f %.2f %.2f\n",c,s,v);
system("pause");
return 0;
}本回答被网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网