Advertisement
mercMatvey4

Untitled

Feb 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. setlocale(LC_ALL,"");
  10. double x, p=1, n=1, sum=0, f, eps;
  11. do
  12. {
  13. cout << "Введите x (0 < |x| < 1) : ";
  14. cin >> x;
  15. } while (abs(x) > 1);
  16. cout << "Введите точность (eps) : ";
  17. cin >> eps;
  18. f = 1 - (1 / pow(1+x,0.25));
  19. while (abs(p) > eps)
  20. {
  21. p *= pow(-1,n+1)*((4*n-3)/(4*n))*x;
  22. sum += p;
  23. n++;
  24. cout << p << endl;
  25. }
  26. cout << "Сумма ряда : " << setprecision(6) << sum;
  27. cout << "\nПроверка : " << setprecision(6) << f;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement