不错。这个都会写了。。继续加油
----------------解决方案--------------------------------------------------------
----------------解决方案--------------------------------------------------------
lz应该是想了解循环的用法,所以N*(N+1)/2这种数学技巧可能并没有回答道lz的问题,那么用循环的话:
int total = 0;
for( int iter = 1; iter <= N; ++iter ) {
total += iter;
}
// you can print total like this
printf("total is: %d\n", total);
----------------解决方案--------------------------------------------------------