zoukankan      html  css  js  c++  java
  • 实验3 分支结构。

    1.

    #include<stdio.h>
    int main()
    {
        double r,s;
    
        printf("Enter r:");
        scanf("%lf",&r);
    
        if(r<=0)
        {
            printf("woring!");
        }
        else
        {
            s=3.1415926*r*r;
            printf("%.2f
    ",s);
        }
    
        return 0;
    }

    2.

    #include<stdio.h>
    int main()
    {
        double r,h,v;
        int i;
    
        printf("Enter r and h:");
        scanf("%lf%lf",&r,&h);
    
        if(r<=0&&h<=0)
        {
            printf("r或h值输入错误请重试!");
        }
        else
        {
            for(i=1;i<=10;i++)
            {
                v=3.1415926*r*r*h*i;
                printf("v=%.0f
    ",v);
            }
        }
    
        return 0;
    }
  • 相关阅读:
    【bzoj1010】[HNOI2008]玩具装箱toy
    bzoj 3173
    bzoj 1179
    bzoj 2427
    bzoj 1051
    bzoj 1877
    bzoj 1066
    bzoj 2127
    bzoj 1412
    bzoj 3438
  • 原文地址:https://www.cnblogs.com/kiero3314/p/3367802.html
Copyright © 2011-2022 走看看