设计程序,s=1/2+2!/3+3!/4+…+(n-1)!/n

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 10:18:30

设计程序,s=1/2+2!/3+3!/4+…+(n-1)!/n
设计程序,s=1/2+2!/3+3!/4+…+(n-1)!/n

设计程序,s=1/2+2!/3+3!/4+…+(n-1)!/n
public static void main(String[] args) {
//设计程序,s=1/2+2!/3+3!/4+…+(n-1)!/n
Scanner input = new Scanner(System.in);
System.out.println("请输入n的值");
int n = input.nextInt();
int sum=0;
for(int i=1;i0;j--){
jx = j*jx;
}
return jx;
}