View Code of Problem 48

#include<stdio.h>
int main()
{
	  int n=0;
	  scanf("%d",&n);
      double sum=0,a=2,b=1;
	  double r;
	  for(b;b<=n;b++)
	  {
		  sum+=a/b;
		  r=b+a;
		  a=r;
	  }
	  printf("%.6f",sum);
	  return 0;
	  
	  
}

Double click to view unformatted code.


Back to problem 48