/*求e */ #include<stdio.h> main() { int n = 1, k = 1; double a, e = 1; printf("请输入精确度:\n"); scanf("%lf",&a); do{ k*=n; n++; e += 1.0/k; }while(1.0/k>a); printf("%lf",e); }
/*求e */ #include<stdio.h> main() { int n = 1, k = 1; double a, e = 1; printf("请输入精确度:\n"); scanf("%lf",&a); do{ k*=n; n++; e += 1.0/k; }while(1.0/k>a); printf("%lf",e); }