Private Sub Command1_Click() '完数定义:一个数如果正好等于它的因子之和,这个数就称为完数。例如,6的因子为1、2、3,而6=1+2+3,因此6是"完数"。 OutputWanNumber 1000 End Sub Sub OutputWanNumber(ByVal n As Integer) Dim i As Integer Dim j As Integer Dim s As Integer For i = 1 To n s = 0 For j = 1 To i\ 2 If i Mod j = 0 Then s = s + j Next j If s = i Then Print i & "是完数" Next i End Sub