View Code of Problem 48

#include <stdio.h>
void main()
{
	int a,t;
  	double sum,b;
  
  	scanf("%d",&a);
  	for(int i=1;i<=a;++i)
        {
        	int m=1;
          	int n=2;
          	b=(double)n/m;
                sum=sum+b;
          	t=n;
          	n=m+n;
          	m=t;
          	
        
        
        }
  printf("%f",sum);
          


}

Double click to view unformatted code.


Back to problem 48