例9.1
#define PI 3.1415926
main()
{float l,s,r,v;
printf("input raDiuS∶");
scanf("%f",&r);
l=2.0*PI*r;
s=PI*r*r;
v=3.0/4*PI*r*r*r;
printf("l=%10.4f\nS=%10.4f\nv=%10.4f\n",l,s,v);
}
运行情况如下,
input radius:4
l=25.1328
s=50.2655
v=150.7966
#define PI 3.1415926
main()
{float l,s,r,v;
printf("input raDiuS∶");
scanf("%f",&r);
l=2.0*PI*r;
s=PI*r*r;
v=3.0/4*PI*r*r*r;
printf("l=%10.4f\nS=%10.4f\nv=%10.4f\n",l,s,v);
}
运行情况如下,
input radius:4
l=25.1328
s=50.2655
v=150.7966