lxhlxx900126
#include<stdio.h>
int main()
{
    int i,n;
    double r,v,h;
    double cylinder(double r,double h);
/*调用一个函数*/
printf(
"enter n:"); scanf("%d",&n); for(i=1;i<=n;i++){ printf("Enter r and h:\n");
/*利用循环来求出多组解*/ scanf(
"%lf%lf",&r,&h); if((r<=0)||(h<=0)) { printf("输入错误,重新输入"); /*用判断语句来分辨出是否符合条件*/ } else{ v=cylinder(r,h); printf("V=%.3f\n",v);/*若符合条件的则代入函数进行运算*/ } } return 0; } double cylinder(double r,double h) { double result; result=3.1415926*r*r*h; return result; }

 

分类:

技术点:

相关文章:

  • 2022-01-21
  • 2021-12-08
  • 2022-01-18
  • 2022-02-20
  • 2022-02-22
  • 2022-01-29
  • 2022-02-21
猜你喜欢
  • 2022-02-03
  • 2022-02-15
  • 2021-12-22
  • 2021-12-01
  • 2021-12-22
  • 2021-12-02
  • 2021-07-16
相关资源
相似解决方案