/*计算求n个圆柱的体积*/ #include<stdio.h> int main(void) { int i,n,r,h;/*r为圆柱底面的半径,h为原著的高*/ double v;/*v为原著的体积*/ printf("the enter n:"); scanf("%d",&n); for(i=1;i<=n;i++){ printf("the enter r:"); scanf("%d",&r); printf("the enter h:"); scanf("%d",&h); if(r<=0||r<=0) printf("The Enter is wrong"); else v=3.14*r*r*h; printf("v=%.2f ",v); } return 0; }