View Code of Problem 48

#include<stdio.h>

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

Double click to view unformatted code.


Back to problem 48