有一个猴子饿了……
有一个猴子饿了,于是摘了若干个桃,第一天吃了一半,又多一个,第二天也是吃了剩下的一半又多一个,……到第十天(第十天没吃),只剩下一个桃子,原来有多少桃子?
Private Sub Form_Click()
Dim s As Integer
Dim i As Integer
s = 1
Print "到第 10天 "; s
For i = 9 To 1 Step -1
s = (s + 1) * 2
Print "到第"; i; "天 "; s
Next i
End Sub
结果是1534个