package com.song.method;
public class Demo07 {
public static void main(String[] args) {
System.out.println(f(1));
}
//1! 1
//2! 2*1
//5! 5*4*3*2*1
//2 2 * f(1)
//3 3 * f(2) f
public static int f(int n){
if (n==1){
return 1;
}else {
return n*f(n-1);
}
}
}
method study Hard.07
最新推荐文章于 2024-08-24 17:09:16 发布