View Code of Problem 48

#include<stdio.h>
int main(){
	int n;int temp;	
	double a=2,b=1;
	double sum;
	sum=a/b; 
	scanf("%d",&n); 
    for(int i=1;i<n;i++){
    	temp=a;
		a=b+a;
		b=temp;		
		sum=sum+a/b; 
	}
	printf("%.6lf",sum);
}

Double click to view unformatted code.


Back to problem 48