View Code of Problem 71

    #include <stdio.h>
    #include <math.h>
    int main()
    {
    	int n,i;
		float a=1,b=2,k;
		float num=0;
		scanf("%d",&n);
		for(i=0;i<n;i++)
		{
			num=num+b/a;
			k=b;
            b=b+a;
            a=k;
		}
        printf("%.2f\n",num);
    }

Double click to view unformatted code.


Back to problem 71