题目:求1+2!+3!+...+20!的和


public class lianxi21 {

    public static void main(String[] args) {

        long sum = 0; 

        long fac = 1;

        for(int i=1; i<=20; i++) {

            fac = fac * i;

            sum += fac;

        }

        System.out.println(sum);

    }

}
[ 尐鱼儿的QQ群:726994578 ] --- [ https://github.com/godmaybelieve ]