首页 > 代码库 > P53

P53

#include<stdio.h>
double fun(double q)
{
	int n=2;
	double s=2.0;
	while(s<=q)
	{
		s=s+(double)(n+1)/n;
		n++;
	}
	return s;
}

main()
{
	printf("%f\n",fun(50));
}