一个两位数,交换它的十位数和个位数上的数字后相减,所得的差是18,像这样的两位数算式,你能写几个?

问题描述:

一个两位数,交换它的十位数和个位数上的数字后相减,所得的差是18,像这样的两位数算式,你能写几个?

31,13
02,20
42,24
13,31
53,35
24,42
64,46
35,53
75,57
46,64
86,68
57,75
97,79
68,86
79,97
用VB写
Option Explicit
Private Sub Form_Load()
Dim i As Long
Dim jiaohuan As String
Dim jieguo As Long
Dim shuju As String
For i = 10 To 99
jiaohuan = Mid(i, 2, 1) & Mid(i, 1, 1)
If Abs(jiaohuan - i) = 18 Then
jieguo = jieguo + 1
shuju = shuju & Mid(i, 2, 1) & Mid(i, 1, 1) & "," & i & vbCrLf
End If
Next
MsgBox jieguo
Text1.Text = shuju
End Sub