View Code of Problem 48

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


}

Double click to view unformatted code.


Back to problem 48