C语言编写,求e的值.e≈1+1/1!+1/2!+1/3!+……+1/n!
C语言编写,求e的值.e≈1+1/1!+1/2!+1/3!+……+1/n!
日期:2008-01-29 20:40:02 人气:1
1.
//---------------------------------------------------------------------------
#include
#define N 50
int main(int argc, char* argv[])
{
double e=1,t=1;
int t1;
for (t1=2;t1<=N;++t1)
{
t*=(double)1/t1;
e+=t;