VB求完全数个数,求修改 Private Sub Command1_Click() Dim s, i, j, n As Integer n = 1 s = 0 For i = 2

2024-12-03 21:04:22
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim s As Integer, i As Integer, j As Integer, n As Integer
n = 1
For i = 2 To 1000
s = 0
For j = 1 To i \ 2
If i Mod j = 0 Then s = s + j
Next j
If i = s Then n = n + 1
Next i
Print n
End Sub