计算 1+1/2!+1/3!+1/4!+...1/20!=?
//计算 1+1/2!+1/3!+1/4!+...1/20!=?
double i ;
double s=0;
double a=1;
for(i=1;i<=20;i++)
{
a=a*i;
s=s+1/a;
}
System.out.println(s);
计算 1+1/2!+1/3!+1/4!+...1/20!=?
//计算 1+1/2!+1/3!+1/4!+...1/20!=?
double i ;
double s=0;
double a=1;
for(i=1;i<=20;i++)
{
a=a*i;
s=s+1/a;
}
System.out.println(s);