View Code of Problem 71

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n;
    float sum =0;
    scanf("%d",&n);
    float a= 1;
    float b = 2;
    for(int i = 0;i < n;i++){
        sum += b/a;
        float temp = a+b;
        a= b;
        b = temp;
    }
    printf("%.2f",sum);
    return 0;
}

Double click to view unformatted code.


Back to problem 71