View Code of Problem 71

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	double a=1,b=2,c,t,s=0;
	for(int i=0;i<n;i++){
		t=b/a;
		s+=t;
		c=a;
		a=b;
		b=a+c;
	}
	printf("%.2f",s);
	return 0;
}

Double click to view unformatted code.


Back to problem 71