View Code of Problem 71

#include<iostream>
using namespace std;

int main(void)
{
  int n;
  double sum=0,t,a=1,b=2;
  cin>>n;
  while(n--)
  {
    sum+=b/a;
    t=a;
    a=b;
    b=b+t;
  }
  printf("%.2lf",sum);
}

Double click to view unformatted code.


Back to problem 71