View Code of Problem 48

#include"stdio.h"
main(){
  int n,i=0;
	scanf("%d",&n);
	double s=0,x=2.0,y=1.0,t;
	for(i=1;i<=n;i++)
	{
		s=s+x/y;
		t=x;
		x=x+y;
		y=t;
	}
	printf("%.6lf",s);
	return 0;
}

Double click to view unformatted code.


Back to problem 48