View Code of Problem 48

#include<stdio.h>
int main()
{
	int i=2,j=1,n,t,x;
	float sum=0.0;
	scanf("%d",&n);
	for(x=1;x<=n;x++)
	{
		sum+=i*1.0/j*1.0;
		t=i;
		i=i+j;
		j=t;
	}
	printf("%.6f\n",sum);
	return 0;
}

Double click to view unformatted code.


Back to problem 48