daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int k;
  8.     cout << "k="; cin >> k;
  9.     float x;
  10.     cout << "x="; cin >> x;
  11.     float a = x;
  12.     float s = a;
  13.     cout << "a = " << a << endl;
  14.     for (int i = 2; i <= k; i++) {
  15.         a = (-1) * a * pow(x, 2) / ((2 * i - 1) * (2 * i - 2));
  16.         s += a;
  17.     }
  18.     cout << "s = " << s << endl;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top