Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- double n, x, Ep, delta, frac, ans;
- cout << "Введите точность: " << endl;
- cin >> Ep;
- n = 1;
- ans = 0;
- frac = 1;
- x = sin(rand());
- while (abs(frac) > Ep) {
- delta = (3 * (2 * n - 1) * (2 * n - 1)) / (2 * n * (2 * n -1));
- frac = frac * delta;
- ans += frac;
- n++;
- }
- cout << "x = " << x << endl;
- cout << "Сумма: " << ans << endl;
- cout << "Встроенная функция: " << log(x + sqrt(1 + x * x)) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement