Abatoor

Untitled

Nov 23rd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main() {
  5.     std::locale::global(std::locale(""));
  6.     double n = 1,add=0,x=0;
  7.     cout << "Введите x: ";
  8.     cin >> x;
  9.     double e=0.001;
  10.     double Sum = 0.0;
  11.    
  12.     do
  13.     {
  14.         add = pow(x, n) / n;
  15.         Sum += add;
  16.         n+=2;
  17.     } while (abs(add) > e);
  18.     cout << "Результат=  " << Sum << endl;
  19.     system("pause");
  20.     return 0;
  21.  
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment