以下代码中temp函数的调用如果没有出现java.lang.StackOverflowError异常,可以把参数值调大
public static void main(String args[]){
System.out.println(temp(10000));
}
public static long temp(long i){
if(i>0){
return i+temp(i-1);
}else{
return i;
}
}
public static long temp2(long i){
long total = 0;
for(;i>0;i--){
total += i;
}
return total;
}