第1个回答 2008-12-07
Dim t As Integer
Function Tao(i As Integer) As Integer
If i < 10 Then '如果i<10则条件成立
t = (t + 1) * 2 计算前一天桃子的个数
i = i + 1 '再推前一天
Tao (i) '递归
End If
End Function
Private Sub Command1_Click()
t = 1
Tao (1) '调用Tao
Print t
'结果t=1534
End Sub
第2个回答 2019-05-11
Dim
t
As
Integer
Function
Tao(i
As
Integer)
As
Integer
If
i
<
10
Then
'如果i<10则条件成立
t
=
(t
+
1)
*
2
计算前一天桃子的个数
i
=
i
+
1
'再推前一天
Tao
(i)
'递归
End
If
End
Function
Private
Sub
Command1_Click()
t
=
1
Tao
(1)
'调用Tao
Print
t
'结果t=1534
End
Sub
第3个回答 2008-12-21
option explicit
dim i as integer,t as integer
t=1
for i = 8 to 1 step -1
t = 2 * ( t + 1 )
next
print t