View Code of Problem 48

#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
     int fz=2;int fm=1;
    double sum=0.0;
    double temp=0.0;
    for(int i=0;i<n;i++){
        sum+=(double)fz/fm;
        temp=fz;
        fz+=fm;
        fm=temp;
    }
    printf("%.6f",sum);
}

Double click to view unformatted code.


Back to problem 48