#include
void main()
{
double b=1.0,sum=1.0,i=1;
do
{
b=1/(i*(i+1));
sum+=b;
i++;
}while(b>=0.000001);
printf("%lf",sum);
}
//运行的结果说1.999001
#include
void main()
{
double b=1.0,sum=1.0,i=1;
do
{
b=1/(i*(i+1));
sum+=b;
i++;
}while(b>=0.000001);
printf("%lf",sum);
}
//运行的结果说1.999001