//求1+2!+3!+...+20!的和 public class Test21 { public static void main(String[] args) { long sum = 1; long sum2 = 0; for (int i = 2; i <= 4; i++) { for (int j = 2; j <= i; j++) { sum = sum * j; System.out.println(sum); } sum2 =sum2 +sum ; sum = 1; } System.out.println(sum2); } }