Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define Я_РУССКИЙ "Russian"
- #include <fstream>
- #include <iostream>
- using namespace std;
- void main() {
- setlocale(LC_ALL, Я_РУССКИЙ);
- int a = 1, n = 0, f = 0;
- long double b = 1, c = 1;
- double x, e, result = 0, prevResult = 0;
- cin >> x >> e;
- do {
- prevResult = result;
- cout << "n= " << n << "\t a = " << a << "\t b= " << b << "\t c= " << c << "\t [[a/b * c = " << (double) a / b * c << "]]" << endl;
- result += (double) a / b * c;
- n = n + 1; f += 2;
- a = a * -1;
- b = b * (f - 1) * f;
- c = c * x * x;
- } while (abs(result - prevResult) > e);
- cout << result << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement