Current location - Loan Platform Complete Network - Big data management - Monkey Eating Peach Problem Recursive VB
Monkey Eating Peach Problem Recursive VB
Private Sub Command1_Click()

Dim a, b, s As Integer

a = 1 'This is the one after day 9, make a = 1

For i = 9 To 1 Step -1 'Number of peaches left over before eating , counting from before eating on day 9

a = (a + 1) * 2 'the number of peaches left before eating each day

Next

Print a

End Sub

Results in 1534, not know what monkeys are so able to eat 。。。。