计算1!+2!+3!+4!+….从第100项到第200项之和。java
时间: 2023-09-22 22:06:01 浏览: 85
java 求1到100之间的和
```java
public class FactorialSum {
public static void main(String[] args) {
long sum = 0;
long factorial = 1;
for (int i = 1; i <= 200; i++) {
factorial *= i;
if (i >= 100) {
sum += factorial;
}
}
System.out.println("The sum of factorials from 100th to 200th is " + sum);
}
}
```
阅读全文