实验七第三题

#include <stdio.h>
#include<math.h>
int main(void )

{
    double x,y;
    printf("Enter x:");
    scanf("%Lf",&x);
    if(x<-2){
        y=x*x;
    }
    else if(x<=2){
        y=2+x;
    }
    else{
        y=sqrt(x*x+x+1);
    }
    printf("y=%.2f\n",y);

    return 0;
    }    

 

posted @ 2013-10-31 09:48  huangsilinlana  阅读(130)  评论(1编辑  收藏  举报