#include<iostream> using namespace std; int XiangCheng(int ); int main() { int n,sum=0; cout<<"please input an number : "<<endl; cin>>n; for(int i=1;i<=n;i++) { sum+=XiangCheng(i); } cout<<"the answer is : "<<sum<<endl; return 0; } int XiangCheng(int index) { int m; m=index*(index+1); return m; }