View Code of Problem 71

#include <stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int m,l;
	m=2,l=1;
	float sum=2;
	int i,t;
	for(i=2;i<=n;i++){
		t=l;
		l=m;
		m=m+t;
		sum+=m*1.0/l;
	}
	printf("%.2f",sum);
	return 0;
}

Double click to view unformatted code.


Back to problem 71