递归的例子

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)); 
}
}

posted @ 2016-11-25 20:08  海星叔  阅读(126)  评论(0编辑  收藏  举报