Vb二级代码有什么错误,求改正
1个回答
展开全部
Option Explicit
Dim k As Integer
Private Sub Command1_Click()
Dim i As Long, mun() As Integer, sum() As Integer
Dim flag As Boolean, j As Integer
For i = 84210 To 90000
DoEvents
flag = True
k = Len(CStr(i))
ReDim mun(k), sum(k)
Call Lnum(i, mun)
Call Lsum(mun, sum)
For j = 1 To k - 1
If mun(j) < sum(j) Then
flag = False
Exit For
End If
Next j
If flag Then List1.AddItem CStr(i)
Next i
End Sub
Private Sub Lnum(ByVal n As Long, num() As Integer)
Dim i As Integer, p As Integer
For i = k To 1 Step -1
p = n Mod 10
num(i) = p
n = n \ 10
Next i
End Sub
Private Sub Lsum(n() As Integer, num() As Integer)
Dim i As Integer, j As Integer
For i = 1 To k - 1
For j = i + 1 To k
num(i) = num(i) + n(j)
Next j
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询