//递归求1-100的和
#include<stdio.h>
int sum(int n)
{
if(1==n)
{
return 1;
}else{
return n+sum(n-1);
}
}
int main()
{
int n;
printf("你需要求前多少个数的和呢\n");
scanf("%d",&n);
int count;
count=sum(n);
printf("答案是%d",count);
return 0;
}
标签:count,return,递归,求和,sum,int,printf
From: https://www.cnblogs.com/swtaa/p/17706306.html