我正在研究一个简单的程序来返回给定输入整数的所有因子。 while循环数组的因子为32,不幸的是我被卡住了。
代码
Dim x As Integer
x = txtInput.Text
Dim factor As Integer
factor = CInt(txtInput.Text) - 1
Dim i As Integer
i = 1
While factor > 0
Do Until i = x
If factor * i = x Then
ListBox1.Items.Add(factor)
i = i + 1
Else
i = i + 1
End If
Loop
factor = factor - 1
End While