View Code of Problem 48

#include<stdio.h>
int main()
{
double sum=0;
double t=1.0,j=2.0;
int i=1,n,temp;
scanf("%d",&n);
while(i<=n)
{
	sum=sum+(j/t);
	temp=j;
	j+=t;
	t=temp;
	++i;
}
printf("%.6f",sum);
}

Double click to view unformatted code.


Back to problem 48