Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- double eps = 1e-9;
- double f(double x) {
- double s, a, c = x;
- int i = 1, z = 1;
- s = 1;
- i = 1;
- a = 1;
- while (a >= eps) {
- z = (2 * i) * (2 * i + 2);
- c *= x;
- a = c / z;
- s += a;
- i++;
- }
- return s;
- }
- int main()
- {
- double h;
- int i;
- cin >> h;
- for (double i = 0.2; i <= 0.6 + eps; i += h) {
- cout << i << " " << f(i) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement