本人是新手小白,求e的值,精确到小数点后第5位
public class Value_of_e {public static void main(String[] args){
double e=1.0,n=1.0,i=n,m=n,j=n;
while(n!=0){
while(n!=1){
n = n-1;
i = i*n;
}
e = e+(m/i);
n = j+1;
j = n;
m = n;
i = n;
}
System.out.println(e);
}
}
我是两个死循环套在一起的,我想要求极限,我要怎么从这两个循环里出来呢?
e=1+1/1!+2/2!+3/3!+~~~+n/n!