Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- double x, e = 1e-6, sum;
- cout << "Введите x (0;1]" << endl;
- cin >> x;
- if (x <= 0 || x > 1) {
- cout << "x не принадлежит (0;1]" << endl;
- return 0;
- }
- double l = -x*x*x*x / 64; //первое слагаемое
- sum = l;
- int k = 1;
- while (fabs(l) >= e) {
- l *= -x*x / (4 * (k + 2)*(k + 2));
- sum += l;
- k++;
- }
- cout << "sum = " << sum << endl;
- cout << "Количество слагаемых " << k << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement