Description
Input
输入一个整数
Output
输出表达式的值
Sample Input
Sample Output
#include <stdio.h>
int sum(int n)
{
int a;
if(n==0)
a=0;
else
a=sum(n-1)+n;
return a;
}
int main()
{
int n;
scanf(“%d”,&n);
printf (“%d\n”, sum(n));
return 0;
}
转载于:https://www.cnblogs.com/deer-king/p/10724474.html