View Code of Problem 71

#include<stdio.h>
void main()
{
    double a = 1, b = 2, i = 0, n;
    double sum = 0, x=0;
    scanf("%lf", &n);
    for(i=0; i<n; i++)
    {
        sum = sum + b/a;
        x = a + b;
        a = b;
        b = x;

    }
    printf("%.2lf", sum);

}

Double click to view unformatted code.


Back to problem 71