public class Sixtheen {
/*利用递归方法求5!。*/
public static void main(String[] args){
System.out.println("5的阶乘是:"+Recursion(5));
}
public static int Recursion (int x){
if(x==1||x==0)
return 1;
else
return x*Recursion(x-1);
}
}
时间: 2024-10-12 16:48:45