View Code of Problem 48

#include <iostream>
using namespace std;

int main(){
  double n,z=2,m=1,sum,t;
  cin>>n;
  for(int j=0;j<n;j++){
    sum+=z/m;
    t = z;
    z += m;
    m = t
  }
  printf("%.6lf",sum);
  return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:12:3: error: expected ';' before '}' token
   }
   ^
*/

Double click to view unformatted code.


Back to problem 48