visualbasic 编程 帮忙填一下啊
下述程序的功能是:找出100以内(含100)自然数对,使两个成对的自然数满足其和与差都是平方数,如26和10,其和为36与差为16均为平方数。程序的思想是:函数过程pf判...
下述程序的功能是:找出100以内(含100)自然数对,使两个成对的自然数满足其和与差都是平方数,如26和10,其和为36与差为16均为平方数。
程序的思想是:函数过程pf判断自然数N是否是平方数,对于自然数i,j,调用函数过程pf,若i + j和j-i同时是平方数,则在列表框内显示i,j。
Private Sub Command1_Click()
For i = 1 To 100
For j = ______ To 100
If ______ Then
List1.AddItem i & " " & j
End If
Next j
Next i
End Sub
Public Function pf(x As Integer) As Boolean
Dim y As Integer, p As Boolean
_______
If y * y = x Then
________
Else
p = False
End If
_________
End Function 展开
程序的思想是:函数过程pf判断自然数N是否是平方数,对于自然数i,j,调用函数过程pf,若i + j和j-i同时是平方数,则在列表框内显示i,j。
Private Sub Command1_Click()
For i = 1 To 100
For j = ______ To 100
If ______ Then
List1.AddItem i & " " & j
End If
Next j
Next i
End Sub
Public Function pf(x As Integer) As Boolean
Dim y As Integer, p As Boolean
_______
If y * y = x Then
________
Else
p = False
End If
_________
End Function 展开
展开全部
Private Sub Command1_Click()
For i = 1 To 100
For j = __i+1____ To 100
If __pf(i + j) And pf(j - i)__ Then
List1.AddItem i & " " & j
End If
Next j
Next i
End Sub
Public Function pf(x As Integer) As Boolean
Dim y As Integer, p As Boolean
___y=sqr(x)____
If y * y = x Then
___p = True_____
Else
p = False
End If
___pf=p______
End Function
For i = 1 To 100
For j = __i+1____ To 100
If __pf(i + j) And pf(j - i)__ Then
List1.AddItem i & " " & j
End If
Next j
Next i
End Sub
Public Function pf(x As Integer) As Boolean
Dim y As Integer, p As Boolean
___y=sqr(x)____
If y * y = x Then
___p = True_____
Else
p = False
End If
___pf=p______
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询