fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main () {
  5. double x, f;
  6. cout<<"x=";
  7. cin>>x;
  8. if ( x<=-7) f = -x * 6 + 20;
  9. // Daca -6x + 20 x<=-7;
  10. if ( x>-7 && x<=0 ) f = x +30;
  11. //Daca X + 30 -7<x<=0
  12. if (x>0) f = sqrt (x);
  13. //
  14. cout<<"f"<<f<<'\n';
  15.  
  16.  
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
6
stdout
x=f2.44949