for a=1 to 30
for b =1 to 30
for c=1 to 30
if a*a+b*b=c*c then print a & "," & b & "," & c
next c
next b
next a
Dim a As Integer
Dim b As Integer
Dim c As Integer
Private Sub Form_Click()
For a = 1 To 30
For b = 1 To 30
For c = 2 To 30
If c * c = a * a + b * b Then
Print (Str(a) + " " + Str(b) + " " + Str(c))
End If
Next c
Next b
Next a
End Sub
如果嫌这样显示不好,可以建个list框,用list1.additem(Str(a) + " " + Str(b) + " " + Str(c))代替print
此程序用的是form_click事件驱动,可以换成command_click