View Code of Problem 71

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

Double click to view unformatted code.


Back to problem 71