实验3

#include<stdio.h>
int main(void)
{
    double r,s;
    
    printf("Enter r:\n");
    scanf("%LF",&r);
     
    if(r<0){
       printf("sorry you enter is wrony!\n");

    }
    
    else{
        s=3.1415926*r*r;
        printf("%.2f\n",s);
       
    }

    return 0;
}
#include<stdio.h>
int main(void)
{
    double r,h,v;
    
    printf("Enter r,h:");
    scanf("%lf%lf",&r,&h);
     
    if(r<0,h<0){
       printf("sorry you enter is wrony!\n");

    }
    
    else{
        v=3.1415926*r*r*h;
        printf("%.3f\n",v);
       
    }

    return 0;
}

 

posted @ 2013-10-14 09:48  wuyanlong  阅读(118)  评论(0编辑  收藏  举报