阶乘-递归-java

public class Main {

    public static void main(String[] args) {
        for (int i=0;i<11;i++){
            System.out.println(jiecheng(i));
        }
    }
    public static int jiecheng(int n){
        if (n==1||n==0) return 1;
        else{
            return jiecheng(n-1) * n;
        }

    }
}

posted @ 2017-08-20 14:14  浩月白雪  阅读(120)  评论(0编辑  收藏  举报