#include <stdio.h>
int summary(int n)
{
int sum;
if(n==1)
{
sum = 1;
}
else
{
sum = n+summary(n-1);//在n=1时,sum=1,在n=2时,sum=2+summary(1),也就是说summary(1)就等于sum就等于1?感觉很不对诶!
}
return sum;
}
int main ()
{
int n = 100;
printf("1+......+100的结果为%d\n:",summary(n));
return 0;
}
求大神解答....
CodeCode
凌小天3635910
精慕门9179926