package chapter_after5;
public class Five_4 {
public static void main(String[] args) {
int num = 20;
double mult, sum = 0;
for (int i = 1; i <= num; i ++) {
mult = 1;
for (int j = 1; j <= i; j++) {
mult *= j;
}
System.out.println( i + "的阶乘为:" + mult);
sum += mult;
}
System.out.println("所有阶乘的和为" + sum);
}
}