求VB大佬帮忙解决一下!!谢谢

2025-01-01 11:42:32
推荐回答(1个)
回答1:

Private Sub Command1_Click()

Randomize

Dim a As Long, b As Long, n As Integer

a = Rnd * 1000 + 1

Do While True

b = rev(a)

If b = a Or n = 7 Then Exit Do

Print a; "+"; b; "="; a + b

a = a + b

n = n + 1

Loop

Print

End Sub

Function rev(ByVal x)

While x > 0

y = y * 10 + x Mod 10

x = x \ 10

Wend

rev = y

End Function