#include "stdio.h"慎竖
int sum(int n){
if(n==1)
return 1;
return n+sum(n-1);
}
int main(int argc,char 哪弯*argv[]){
printf("1+2+3+...+100 = %d\n",sum(100));
return 0;
}
运行样例:宽缓大
#include "stdio.h"慎竖
int sum(int n){
if(n==1)
return 1;
return n+sum(n-1);
}
int main(int argc,char 哪弯*argv[]){
printf("1+2+3+...+100 = %d\n",sum(100));
return 0;
}
运行样例:宽缓大