Skip to content

Instantly share code, notes, and snippets.

@selevit
Created September 14, 2012 20:22
Show Gist options
  • Save selevit/3724502 to your computer and use it in GitHub Desktop.
Save selevit/3724502 to your computer and use it in GitHub Desktop.
#include <iostream>
int main()
{
int x = 1;
int result = 0;
int n;
std::cout << "N = ";
std::cin >> n;
for (int i = 1; i < n; ++i) {
result += i * i + 1;
}
std::cout << "Result is " << result << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment