//递归方法求阶乘
public class test{
public static void main(String[] args){
System.out.print(fun(3));
}
//阶乘
private static int fun(int n){
if(n==1){
return 1;
}else{
return n*fun(n-1);
}
}
}
递归方法求阶乘
猜你喜欢
转载自blog.csdn.net/weixin_43311389/article/details/82917445
今日推荐
周排行