fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int y;
  9. const float pi = 3.14f;
  10. float U;
  11. cout << "Введіть значення y:\n";
  12. cin >> y;
  13. if (y >= 2)
  14. {
  15. U = sqrt(pow(y, 2) + y + 1.5f);
  16. }
  17. else if (y < 2 && y > -2)
  18. {
  19. U = pi + pow(cos(y+ 1.2f), 2);
  20. }
  21. else if(y <= -2)
  22. {
  23. U = log(pow(y, 2) + 2) + pi;
  24. }
  25. else
  26. {
  27. cout << "Невірне значення y, спробуте ще раз";
  28. main();
  29. }
  30. cout << U << endl;
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
Введіть значення y:
32765.5