编辑代码

public class Factorial{
    public static void main(String[] args){
        long sum=0,fact;
        for(int n=1;n<=7;n++){
            fact = 1;
            for(int m = 1;m<=n;m++)
                fact*=m;
            sum+=fact;
        }
        System.out.println("sum="+sum);
    }
}