View Code of Problem 48

#include <stdio.h>
int main(){
	
  int n=3,i=2;
  int f1=1,f2=2,f3;
  double sum = f2/f1;
  scanf("%d",&n);
  for(i=0;i<n-1;i++){
  	f3 = f1+f2;
    	sum+=f3/f2;
    	f1=f2;
    	f2=f3;
  
  }
  printf("%.6f",sum);
 
return 0;
}

Double click to view unformatted code.


Back to problem 48