StoneHaos

ser

Jun 30th, 2020
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(void) {
  7.     double S = 1, elem = 1, eps;
  8.     cin >> eps;
  9.     for (int i = 0; fabs(elem) > eps; ++ i) {
  10.         elem *= -1 / ((2.0 * i + 2) * (2.0 * i + 3));
  11.         S += elem;
  12.     }
  13.     cout << S << endl;
  14.     return 0;
  15. }
RAW Paste Data