Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n = 0;
- cin >> n;
- int left = 1;
- int middle = 2;
- int right = 3;
- int series = 1*2;
- while (right < 2 * n) {
- left++;
- middle++;
- right++;
- series += left * middle * right;
- }
- cout << series << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement