int main(){ double e=1,t=1;int i,n;scanf("%d",&n);for(i=1; i<=n; i++){t/=i;e+=t;} printf("%f\n",e);return 0;}
方法4:include <stdlib.h> #include <stdio.h> int Fibon1(int n);int main(){int n = 0;int m=0;int ret = 0;printf("请输入要计算的斐波那契数列的前N项总数:");scanf("%d", &n);m=n;do{ret += Fibon1(n);n--;} while (n>0);printf("前%d项目和ret=%d", m,ret)...
int main(){ double e=1,t=1;int i,n;scanf("%d",&n);for(i=1; i<=n; i++){t/=i;e+=t;} printf("%f\n",e);return 0;}