Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <conio.h>
- using namespace std;
- int main() {
- double e, x, sum = 0, s, fact;
- int i, k = 0;
- cout << "x = ";
- cin >> x;
- cout << "e = ";
- cin >> e;
- do
- {
- k++;
- fact = 1;
- for (i = 1; i <= k; ++i)
- fact *= i;
- s = pow(-1.0, k) * pow(0.5 * x, 2.0 * k + 1) / pow(fact, 2) / (k + 1);
- sum += s;
- }
- while (s > e);
- cout << "summa ravha " << sum;
- getch ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement