Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- double y, x, t, eps; int i,n;
- cout << "enter eps = ";
- cin >> eps;
- cout << "enter n = ";
- cin >> n;
- for (int j = 0; j < n; j++) {
- cout << "enter x = ";
- cin >> x;
- i = 0;
- y = 0;
- t = 1;
- while (abs(t) > eps)
- {
- y += t;
- i++;
- t = -t * pow(x*x - x + 1, 2) / (2*i*(2*i-1));
- }
- cout << y << endl;
- cout << cos(x*x - x + 1) << endl;
- }
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment