问题
填空题
本程序的功能是找出10到60之间所有不可以表示成两个平方数之和的数,请完善本程序
Option Explicit
Private Sub CmdFind_Click()
Dim i As Integer,j As Integer,k As Integer
Dim p As Integer,q As Integer
For i=10 To 60
For j=1 To Int(Sqr(i))
()
q=i-P
If q<>0 And judge(q) Then Exit For
Next j
If () Then
k=k+1
Text1.Text=Text1.Text & i & " "
If k Mod 5=0 Then Text1.Text=Text1.Text & vbCrlf
End If
Next i
EndSub
Public Function judge(ByVal x As Integer)As Boolean
If () Then
judge=True
Else
judge=False
End If
End Function
答案
参考答案:p=j*j;j=int(sqr(i))+1 或j>int(sqr(i));int(sqr(x))=sqr(x)