fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int x;
  8. cin>>x;
  9. while(x!=0)
  10. {
  11. cout<<(x*(x+1)*(2*x+1))/6<<"\n";
  12. cin>>x;
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 15232KB
stdin
2
1
8
0
stdout
5
1
204