View Code of Problem 71

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

Double click to view unformatted code.


Back to problem 71