递归

1、递归太多会影响机器的性能

2、递归使用求n!

public static void main(String[] args) {
        int result=  a(3);
        System.out.println(result);
    }
    public static int a(int i){
        if (i==1){
            return 1;
        }else {
            return i*a(i-1);
        }
    }

 

posted @ 2022-11-27 13:56  热爱编程的小赵  阅读(34)  评论(0)    收藏  举报