找出1--1000之间的完全数。如6=1+2+3,6即为完全数。
求高手写出源代码,急急急急急急!!!!!!!!!!!!
[解决办法]
Private Sub Command1_Click() Dim i As Long Dim j As Long Dim s As Long Dim text As String For i = 1 To 1000 s = 0 text = "=" For j = 1 To i - 1 s = s + j text = text & CStr(j) & "+" If (s = i) Then text = Left(text, Len(text) - 1) Debug.Print (s & text) Exit For End If Next NextEnd Sub