运行效果见图:
代码如下:
Option Explicit
Private Sub Command1_Click()
Dim G As Integer
Dim S As Integer
Dim g1 As Integer, g2 As Integer
Dim s1 As Integer, s2 As Integer
Dim b1 As Integer, b2 As Integer
Dim pfs1 As Integer, pfs2 As Integer
Me.Cls
For S = 1 To 9
For G = 0 To 9
If S < G Then
pfs1 = (S * 10 + G) ^ 2
pfs2 = (G * 10 + S) ^ 2
g1 = pfs1 Mod 10
s1 = pfs1 \ 10 Mod 10
b1 = pfs1 \ 100
g2 = pfs2 Mod 10
s2 = pfs2 \ 10 Mod 10
b2 = pfs2 \ 100
If g1 = b2 And s1 = s2 And b1 = g2 Then
Print S * 10 + G; "^2="; pfs1, G * 10 + S; "^2="; pfs2
End If
End If
Next G
Next S
End Sub
我不会啊啊