View Code of Problem 71

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

Double click to view unformatted code.


Back to problem 71