求阶乘
5! = 5 * 4! = 5 * 4 * 3! = …
public class Test{
public static void main(String[] args) {
int a = 6;
System.out.println(fac(a));
}
public static int fac(int num){
if (num <= 1){
return 1;
}else{
return num * fac(num - 1);
}
}
}