阶乘-递归-java
public class Main { public static void main(String[] args) { for (int i=0;i<11;i++){ System.out.println(jiecheng(i)); } } public static int jiecheng(int n){ if (n==1||n==0) return 1; else{ return jiecheng(n-1) * n; } } }
public class Main { public static void main(String[] args) { for (int i=0;i<11;i++){ System.out.println(jiecheng(i)); } } public static int jiecheng(int n){ if (n==1||n==0) return 1; else{ return jiecheng(n-1) * n; } } }