计算(LnN!)的值


import java.util.*;
import java.math.*;
public class CaculatorLnN {

public static void main(String[] args) {
// TODO 自动生成的方法存根
int N;
System.out.println("please input N");
Scanner in=new Scanner(System.in);
N=in.nextInt();
double ln;
factorial fac=new factorial();
int factor=fac.factorial(N);
System.out.println(ln=Math.log(N));
}

}
class factorial{
static int one=1;
public static int factorial(int N){
if(N<0){
System.out.println("请输入正确的整数");
return -1;
}
if(N==1||N==0){
return one;
}
return factorial(N-2)*factorial(N-1);
}
}

posted @ 2016-09-24 18:41  dortmund  阅读(2389)  评论(0编辑  收藏  举报