填空题
执行下列程序,单击按钮Command1后,窗体上第一行内容是
1,第二行内容是
2,最后一行内容是
3。
Option Explicit
Private Sub Command1_Click()
Dim st As String, ch As String*1, t As Integer
Dim i As Integer
st="2 4 6 8 16#"
For i=1 To Len(st)
ch=Mid(st, i, 1)
If ch<>""And ch<>"#"Then
t=t*10+Val(ch)
Else
If judge(t)Then Print t
t=0
End If
Next
End Sub
Private Function judge(ByVal n As Integer) As Boolean
Do While n<>1
If n Mod 2<>0 Then
Exit Function
End If
n=n/2
Loop
judge=True
End Function