首页 > 技术文章 > 递归的例子

MissSu 2016-11-25 20:08 原文

public class Factorial {
//递归程序
static int f(int a){
return a == 0?1:a*f(a-1);
}
public static void main(String[] args) {
System.out.println(f(10)); 
}
}

推荐阅读