计算圆柱体积

#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;
}

posted @ 2025-01-02 15:51  Grit_Doyle  阅读(42)  评论(0)    收藏  举报