View Code of Problem 71

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

Double click to view unformatted code.


Back to problem 71