编码
public class Factorial { public static void main(String[] args) { System.out.println(fac(6)); } public static long fac(int n){ if(n>1) { return n * fac(n-1); }else { return 1; } } }
public class Factorial { public static void main(String[] args) { System.out.println(fac(6)); } public static long fac(int n){ if(n>1) { return n * fac(n-1); }else { return 1; } } }
转载于:https://www.cnblogs.com/liyizhu/p/10575890.html