View Code of Problem 48

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
	int i,n;
	double a=2,b=1,s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		s=s+a/b;
		a=a+b;
		b++;
	}
	printf("%.6lf\n",s);
  return 0;
}

Double click to view unformatted code.


Back to problem 48