Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double x, epsilon;
- cout << "Введите значение x (в радианах): ";
- cin >> x;
- cout << "Введите точность ε: ";
- cin >> epsilon;
- double term;
- term = x;
- double sum;
- sum = term;
- int n;
- n = 1;
- while (fabs(term) >= epsilon) {
- term *= -x * x / ((2 * n) * (2 * n + 1));
- sum += term;
- cout << "sin(x) = " << sum << std::endl;
- n++;
- }
- cout << "Итоговый результат: ";
- cout << "sin(" << x << ") = " << sum << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement