/*求e的近似值*/ #include"stdio.h" void main() { float i,m=1; float e=1,n; printf ( "请输入正整数n:\n" ); scanf ( "%f",&n ); for ( i=1; i<=n; i++ ) { m=m*i; e=e+1/m; } printf ( "e的值为:%f\n",e ); }