Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int n, i = 1;
- float e, s = 0, b = 1/3;
- cout << "e="; cin >> e;
- while (fabs(b)>= e)
- {
- s += -1; i++;
- b / pow(3, 2 * i - 1);
- }
- cout << "s=" << s << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment