回复 楼主 木兮槿
//计算1!+2!+....n!
import java.util.Scanner;
public class MiCi {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("请输入n的值:");//n为正整数
int n=in.nextInt();
int sum=0;
int number=1;
for(int j=1;j<=n;j++){
number=number*j;
sum=sum+number;
}
System.out.println("计算结果为:"+sum);
}
}