public class Homework5 {
public static void main(String[] args) {
long sum = 0,item = 1;
int i = 1;
while (i<=100) {
sum=sum+item;
i++;
item=item*i;
}
System.out.println("e="+sum);
long a = 0,b = 1;
int c = 1;
while (c<=200) {
a=a+b;
c++;
b=b*c;
}
System.out.println("e2="+a);
System.out.println(a-sum);
}
}
最后结果是e=1005876315485501977
e2=1005876315485501977
0
i<=50的时候得出的又是一个负值,不懂为啥,求解惑!