//数字太大了就没用了哦!
import java.util.Scanner;
public class DG_Demo {
static int n;
// 递归
public static int Numbers(int i){
if(i == 1)
return 1;
else {
return i * Numbers(i-1);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
System.out.println(n+"! = "+Numbers(n) );
}
}
JAVA——递归
于 2022-01-16 15:29:24 首次发布