dim x() as string
dim i,j as integer
for j=100 to 500 for i = 1 to 3 x(i)=mid(j,i,1) next if val(x(1))+val(x(2))+val(x(3))=5 then print x(1) & x(2) & x(3)
next
dim x() as integer
dim i,j as integer
dim Temp as integer
for j=100 to 500 for i = 0 to 2 x(i)=val(mid(j,i,1)) if x(i)>5 then goto 10 next Temp=x(0)+x(1)+x(2) if Temp<=5 then print x(0) & x(1) & x(2) end if
10:
next
Private Sub Form_Click()
Dim a, b, c, d As Integer
For i = 100 To 500 '
a = i Mod 10'个位数
b = i / 10 Mod 10 '十位数
c = Int(i / 100)'百位数 If a + b + c = 5 Then Print i End If
Next i
End Sub
这是我的理解不知道是不是你要的。
Private Sub Command1_Click() Dim i As Integer, j As Integer For i = 1 To 4 For j = 0 To (5 - i) \ 2 k = 5 - i - j Print i & j & 5 - i - j If j <> k Then Print i & 5 - i - j & j Next 'Print Next
End Sub