Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int k;
- cout << "k="; cin >> k;
- float x;
- cout << "x="; cin >> x;
- float a = x;
- float s = a;
- cout << "a = " << a << endl;
- for (int i = 2; i <= k; i++) {
- a = (-1) * a * pow(x, 2) / ((2 * i - 1) * (2 * i - 2));
- s += a;
- }
- cout << "s = " << s << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement