填空题 将下面的语句段(a)补充完整,使其和语句段(b)在功能上完全等价:
(a)double s=0.0;
1;
int k=0;
do{
s+=d;
2;
d=1.0/(k*(k+1));
}while( 3);
(b)double s=1.0;
for(int k=1;k<=10;k++)s+=1.0/(k*(k+1));
【正确答案】
【答案解析】double d=1.0
k++
k<=10