好辛苦啊,脑子真不好使啊!
不过总算编出来了……
程序还是挺简洁的!
Option Explicit
Private Sub Form_Click()
'声明a()数组,存贮17个自然数
Dim a(16) As Integer, i As Integer, m As Integer, s As Integer, t As Integer
m = 17
For i = 0 To 16
a(i) = i + 1
Next i
Do While s <> 1
'检验是否为3的倍数
For i = 0 To 16
If a(i) Mod 3 = 0 Then
a(i) = 0
Else
t = i
End If
Next i
'循环报数
For i = 0 To 16
If a(i) <> 0 Then
m = m + 1
a(i) = m
End If
Next i
'检验是否只剩下最后一个数
s = 0
For i = 0 To 16
If a(i) <> 0 Then
s = s + 1
End If
Next i
Loop
Print "编号为" & t
Print "Last number " & "(编号)" & t & "is " & a(t) - 1
End Sub