Advertisement
myloyo

5.3.15

Nov 20th, 2022 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 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.     double s, eps, a;
  11.     s = 0;
  12.     a = 1;
  13.     cin >> eps;
  14.     while (a >= eps) {
  15.         a /= 2;
  16.         s += a;
  17.     }
  18.     cout << s << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement