View Code of Problem 71

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

	
	return 0;
}

Double click to view unformatted code.


Back to problem 71