View Code of Problem 71

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	float s=0,m=2,n=1,t;
	int i,a;
	scanf("%d",&a);
	for(i=1;i<=a;i++)
	{
		s=s+m/n;
		t=m;
		m=m+n;
		n=t;
		
	}
	printf("%.2f",s);
	return 0;
}

Double click to view unformatted code.


Back to problem 71