函数f(n)=1/1!+1/2!+1/3!+...+1/n!的值

时间:2021-11-09 17:03:05
 1 piblic Double Solution(int n)
 2 {
 3     Dounle ret = 0;
 4     for(int i = 1;i <= n;i++)
 5     {
 6         int dishu = 1;
 7         for(int j = 1;j <= n;j++)
 8         {
 9             dishu *= j;
10         }
11         ret += 1 / (Do  uble)dishu;
12     }
13     return ret;
14 }

 

相关文章