#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; }
33.求1*2+2*3+3*4+……前n项的和,布布扣,bubuko.com
原文:http://www.cnblogs.com/jixiaowu/p/3896783.html