View Code of Problem 71

#include<stdio.h>
int main()
{	
	int k,n,temp;
	float sum=0,i=2.0,j=1.0;
	scanf("%d",&n);	
	for(k=0;k<n;k++)
	{
		sum+=i/j;	
		temp=i;
		i=i+j; 
		j=temp;				
	}
	printf("%0.2f",sum);
	return 0;	
}

Double click to view unformatted code.


Back to problem 71