#include <stdio.h> int main(){ int N; double f=2.0; double m=1.0; int i; double c; double my_sum=0.0; if (scanf("%d",&N)!=0){ for (i=1;i<=N;i++){ my_sum+=f/m; c = f; f = f+m; m = c; } printf("%.2f",my_sum); }else{ printf("输入信息出错"); } return 0; }
c语言编程练习题:7-34 求分数序列前N项和
作者:yunjinqi
类别:编程
日期:2023-05-29 14:02:04
阅读:620 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/159
最新文章
系统当前共有 404 篇文章