#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; }
#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; }
天 : 20052
小时 : 467878
分钟 : 28072692
秒 : 1684361520