Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- int main() {
- int x;
- cin >> x;
- double c = cos(x);
- cout << fixed << setprecision(10) << c << endl;
- int s = 2;
- int chisl = 1;
- int znam = 1;
- double ans = 1;
- int f = -1;
- while (c != ans) {
- znam *= (s - 1) * s;
- chisl *= x * x;
- ans += f * (chisl / znam);
- f *= f;
- s += 2;
- }
- cout << setprecision(10) << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement