View Code of Problem 71

#include<stdio.h>
int main()
{
	int i=1,n;
	double t,x=1,y=2,s,sum=0;     
	scanf("%ld",&n);   
	while(i<=n) 
	{
		s=y/x;
		sum=sum+s;
		t=y;
		y=y+x;
		x=t;
		i++;
	}    
	printf("%.2f\n",sum);   
	return 0;
}

Double click to view unformatted code.


Back to problem 71