#include<stdio.h> int main(void) { double r,h,v,n; printf("Enter r,h and n "); scanf("%lf%lf%lf",&r,&h,&n); if(r<=0||h<=0) { printf("输入错误,重新输入"); } else{ v=cylinder(r,h,n); printf("v=%.3f\n",v); } return 0; } double cylinder(double r,double h,double n) { double result; result=3.1415926*r*r*h*n; return result; }