#include<iostream>
#include<iomanip>
using namespace std;
int jc(int n)
{
int s = 1;
for (int i = n; i > 1; --i)
s *= i;
return s;
}
int main()
{
cout << "n e" << endl;
cout << "- -----------" << endl;
cout << "0 1" << endl;
cout << "1 2" << endl;
cout << "2 2.5" << endl;
double t,s=2.5;
for (int n = 3;n<10; ++n)
{
t = 0;
s = 2.5;
for (int i = 3; i <= n; ++i)
{
double f = jc(i);
t = t + 1 / f;
}
s = s + t;
cout <<fixed<<setprecision(9)<< s << endl;
}
return 0;
}
1012 u Calculate e
最新推荐文章于 2018-12-23 23:52:22 发布