static Long result=1L;
public static void main(String[] args){
System.out.println("factorial="+factorial(3));
}
public static Long factorial(int index){
Long fac=0L;
if(index==1){
return 1l;
}
else{
fac=index*factorial(index-1);
result+=fac;//第最内层调用result=1+2*1,外层result=1+2*1+3*2*1
System.out.println(result);
}
return result;
}
3、2、1阶乘的结果相加,结果不对,