求圆面积,圆周长,圆球表面积,圆球体积,圆柱体体积

#include<stdio.h>
int main()
{
	float r;
	float h;
	double S1=0.0;
	double L1=0.0;
	double S2=0.0;
	double V2=0.0;
	double V=0.0;
	printf("input r and h:\n");
	scanf("%f%f",&r,&h);
	S1=3.14*r*r;        //圆面积
	L1=2*3.14*r;        //圆周长
	S2=4*3.14*r*r;      //圆球表面积
	V2=(4/3)*S1*r;      //圆球体积
	V=S1*h;             //圆柱体积
	printf("%f\n",S1);
	printf("%f\n",L1);
	printf("%f\n",S2);
	printf("%f\n",V2);
	printf("%f\n",V);
	return 0;
}

你可能感兴趣的:(printf)