找规律...//2/1+3/2+5/3+...#include<stdio.h>
int main(){ int i; float sum=0,f1=2,t,f2=1; for(i=1;i<=20;i++) { sum=sum+f1/f2; t=f2; f2=f1; f1=t+f1; } printf("结果是:%f\n",sum); return(0);}
main(){ float n=1.0,m=2.0; float nr,sum=2.0; int i;
for(i=1;i<20;i++) { nr=m; sum+=(m+=n)/(n=nr); } printf("%f\n",sum); getch();}
int main(){ int i; float sum=0; float f1=2,t,f2=1; for(i=1;i<=20;i++) { sum=sum+f2/f1; t=f1; f1=f2; f2t+f2; } printf("结果是:%f\n",sum); return(0);}