#include<stdio.h> #include<math.h> int main() { int i,n,t; float a,b,p; scanf("%d",&n); a=2; b=1; p=a/b; for(i=1;i<n;i++) { t=a; a=a+b; b=t; p=p+(a/b); } printf("%.2f\n",p); return 0; }
Double click to view unformatted code.