Advertisement
kadeyrov

Untitled

Oct 7th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  AndeyLess
  4. //
  5. //  Created by Kadir Kadyrov on 08.07.2020.
  6. //  Copyright © 2020 Kadir Kadyrov. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <vector>
  11. #include <algorithm>
  12. #include <cmath>
  13.  
  14. using namespace std;
  15.  
  16. int main() {
  17.     int n;
  18.     double x;
  19.     cin >> n >> x;
  20.     double sum = 0;
  21.     for (int i = 1; i <= n; i++) {
  22.         sum += (pow(x, i - 1) / (i * i - 2));
  23.     }
  24.    
  25.     cout << sum << endl;
  26.    
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement