double r,h,c,s,t,v,sv;
sacnf("%f%f\n",&r,&h);
c = 2*3.14*r;
s = 3.14*r*r;
t = 4*3.14*r*r;
v = (4/3)*3.14*r*r*r;
sv = s*h;
printf("周长 = %.2f",c);
printf("圆面积 = %.2f",s);
printf("球面积 = %.2f",t);
printf("球体积 = %.2f",v);
printf("圆柱体积 = %.2f",sv);
周长:3.14*1.5*2=9.42
面积:3.14*1.5^2=7.065
表面积:3.14*1.5^2*2+3.14*1.5*2*3=7.065*2+9.42*3=14.13+28.26=42.39
体积:3.14*1.5^2*3=7.065*3=21.195
#include
#include
#include
#define PI 3.141592
int main()
{
float r,h,zhz,ymj,yzhbmj,yzhtj;
printf("Input your number\r");
scanf("%f",&r);
printf("Input your number\h");
scanf("%f",&h);
zhz=2*PI*r;
ymj=PI*r*r;
yzhbmj=zhz*(r+h);
yzhtj=ymj*h;
printf("%f ",zhz);
printf("%f ",ymj);
printf("%f ",yzhbmj);
printf("%f ",yzhtj);
return 0;
}
解释:zhz是圆周长,ymj是圆面积,yzhbmj是圆柱体表面积,yzhtj是圆柱体积。
题目有圆柱体,没有什么圆球。