View Code of Problem 71

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

Double click to view unformatted code.


Back to problem 71