计算圆柱体积
#include<stdio.h>
double cylinder(double r,double h);//函数声明
int main(){
double height,radius,volume;
printf("Enter radius and height:");//提示输入半径和高度
scanf("%lf%lf",&radius,&height);//输入半径和高度
volume=cylinder(radius,height);//调用函数
printf("Volume=%.3f\n",volume);
return 0;
}
double cylinder(double r,double h){
double result;
result=3.1415926*r*r*h;
return result;
}

浙公网安备 33010602011771号