N的阶乘 和fibn数列

阶乘:

规律:N!=(n-1)! * n;

出口 n==1 或 n==0 return 1;

public static int getResult(int n){

if(n<0)

throw new validateException("非法参数");

}

if(n==1 || n==0){

return 1;

}

return getResult(n-1)*n

posted @ 2021-07-16 21:52  王子剑  阅读(246)  评论(0)    收藏  举报