1
#include <iostream>2
#include <iomanip>3
using namespace std;4

5
const int N = 9;6

7
int factorial(int n)8


{9
if(n == 0)10
return 1;11
return n * factorial(n - 1);12
}13

14
int _tmain(int argc, _TCHAR* argv[])15


{16
cout << "n e" << endl;17
cout << "- -----------" << endl;18
19
double result = 0.0f, temp;20

21
for(int i = 0; i <= N; ++i)22

{23
result = 0.0f;24

25
for(int j = i; j > -1; --j)26

{27
result += 1.0 / factorial(j);28
}29

30
if(i > 2)31

{32
printf("%d %.9f\n", i, result);33
}34
else35

{36
cout << i << " " << result << endl;37
}38
}39
return 0;40
}

