Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- double e;
- cout << "vvedite e\n";
- cin >> e;
- double sum = 0;
- double a = e;
- int n = 1;
- while(fabs(a) >= e)
- {
- double f = 1;
- for(int i = 0; i < n; i++)
- f *= 2;
- double s = 1;
- for(int i = 0; i < n; i++)
- s *= 3;
- a = (double) f / s;
- sum += a;
- n++;
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement