A-A+

阅读下面利用递归来求n!的程序 class FactorialTest { static l

2022-08-05 21:51:07 问答库 阅读 172 次

问题详情

阅读下面利用递归来求n!的程序 class FactorialTest { static long Factorial(int n){ //定义Factorial()方法 if(n==1)return 1; else return n * Factorial(______); } public static void main(String a[]) { //main()方法 int n=8; System.out.println(n+"!="+Factorial(n)); } } 为保证程序正确运行,在下画线处应该填入的参数是
A.n-1
B.n-2
C.n
D.n+1请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:A

考点:程序