#include<stdio.h> void main() { int i=1,j=1; float e=1.0,k; do{ j=i*j; k=1.0/j; e=e+k; i++; }while(k>1e-5);/*判断误差是否小于给定的误差限E=0.00001 */ printf("%f,n=%d\n",e,i); }