#include <math.h>
#include <stdio.h>
double calculateE(double precision) {
double e = 1, temp = 1;
int count = 1;
for (int i = 1; i < 1000000; i++) {
for (int j = 1; j <= i; j++) {
temp *= j;
}
if (fabs(1.0 / temp) < precision) {
break;
}
e += 1.0 / temp;
count++;
temp = 1;
}
return e;
}
int main() {
double precision;
printf("请输入精确度(例如10e-6):");
scanf("%le", &precision);
double e=calculateE(precision);
printf("e的近似值为%.6lf\n", e);
return 0;
}