#include "stdio.h"
#include "stdlib.h"
int main()
{
double d,e,n,jc;
int i,m;
char ws[32];
printf("输入精确度:");
scanf("%lf",&d);
jc=1;
e=1;
n=1;
do
{
jc=jc*n;
e+=1/jc;
n+=1;
}while((1/jc)>d);
if(e>1)
printf("%d.",int(e));
while(e>1)
e=e-double(int(e));
do
{
e=e*10;
printf("%d",int(e)%10);
d=d*10;
}while(d<1);
}
#include"math.h"
void main()
{
float e=1.0,temp=1.0;
int i,p=1;
for(i=1;fabs(temp)>1e-6;i++)
{
p=i*p;
temp=1.0/p;
e=e+temp;
}
printf("%f",e);
}