#include<stdio.h>double fun(int i){int j;double sum=1;for(j=1;j<=i;j++)sum*=j;return sum;}void main(){int i,n;double sum=0;printf("请输入n值:\n");scanf("%d",&n);for(i=1;i<=n;i++)sum+=1/fun(i);printf("1+1/2!+1/3!+....1/n!=%.7lf\n",sum);}
- 1 回答
- 0 关注
- 1735 浏览
添加回答
举报
0/150
提交
取消