VB的这题程序编程有人会吗,帮忙下谢谢,好的就直接采纳了! 有会的麻烦回答下感激不尽!!都没人吗??
2个回答
展开全部
运行效果见图:
代码如下:
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询