java计算1-10阶乘的和
// 计算1-10阶乘的和
public class Work7 {
public static void main(String[] args) {
int factorial = 1;
int sum = 0;
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= i ; j++) {
factorial *= j; // get factorial
}
sum += factorial; // sum factorial
factorial = 1;
}
System.out.println(sum);
// 4037913
}
}