fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(void) {
  4. double x,y;
  5. scanf("%lf",&x);
  6. if(x<1||x>=5){ printf("No define!\n");
  7. return 0;
  8. }
  9. else if(x>=1.0&&x<2.0) y=3.0*x+5;
  10. else if(x>=2.0&&x<3.0) y=2*sin(x)-1;
  11. else if(x>=3.0&&x<4.0) y=sqrt(1+x*x);
  12. else if(x>=4.0&&x<5.0) y=x*x-2*x+5;
  13. printf ("%lf",y);
  14. // your code goes here
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5328KB
stdin
1
stdout
8.000000