Advertisement
myloyo

5.2.10

Nov 20th, 2022 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <algorithm>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n, k;
  11.     double x, s, d;
  12.     s = 0;
  13.     cin >> k >> x;
  14.     d = ((-1) * x / 2);
  15.     for (n = 1; n <= k; n++) {
  16.         s += d / (7 * n);
  17.         d *= ((-1) * x / 2);
  18.     }
  19.     cout << s;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement