32.求1+(1+2)+(1+2+3)+(1+2+3+4)+……的前n项的和
#include<iostream> using namespace std; int QiuHe(int); int main() { int n; int sum=0; cout<<"please input an number : "<<endl; cin>>n; for(int i=1;i<=n;i++) { sum+=QiuHe(i); } cout<<"the mount of the series is : "<<sum<<endl; return 0; } int QiuHe(int index) { int sum1=0; for(int j=1;j<=index;j++) { sum1+=j; } return sum1; }