不好意思,手头没VB6编译器,想了一下,好像写错了,改了一下:dim s,num as integers=0num=1do while s<=5000 num=num*2 s=s+numloopprint s-num最后s是大于5000才停的,所以要减一下最后一个加的数字。
dim s,num as integers=0num=2do while s<=5000 s=s+num num=num*2loopprint s