Advertisement
Sanlover

Untitled

Sep 28th, 2021
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     double summary = 0;
  7.     int N;
  8.  
  9.     cout << "Enter the amount of elements(N): ";
  10.     cin >> N;
  11.  
  12.     for (int i = 0; i < N; i++)
  13.     {
  14.         double temp = 1.0 / double((i + 1) * (i + 1) * (i + 1));
  15.         summary += temp;
  16.     }
  17.  
  18.     cout << endl << "Your summary is " << summary << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement