#include <stdio.h> void main(){ int n,t; double i=1,j=2,s=0; scanf("%d",&n); while(n>0){ s+=(j/i); t=j; j=i+j; i=t; n--; } printf("%.6f",s); }
Double click to view unformatted code.