View Code of Problem 48

#include<stdio.h>
#include<math.h>
void main ()
{
    int i,n;
	double a=1,b=2,s=0.0,t;
    scanf("%d",&n);
	
	for(i=1;i<=n;i++)
	{
		s=s+b/a;
	    t=b;
		b=a+b;
		a=t;
	}
    printf("%f\n",s);
}

Double click to view unformatted code.


Back to problem 48