[填空题] 本程序的功能是找出10到60之间所有不可以表示成两个平方数之和的数,请完善本程序Option ExplicitPrivate Sub CmdFind_Click()Dim i As Int

15 查阅

[填空题] 本程序的功能是找出10到60之间所有不可以表示成两个平方数之和的数,请完善本程序Option ExplicitPrivate Sub CmdFind_Click()Dim i As Integer,j As Integer,k As IntegerDim p As Integer,q As IntegerFor i=10 To 60For j=1 To Int(Sqr(i))()q=i-PIf q<>0 And judge(q) Then Exit ForNext jIf() Thenk=k+1Text1.Text=Text1.Text & i & " "If k Mod 5=0 Then Text1.Text=Text1.Text & vbCrlfEnd IfNext iEndSubPublic Function judge(ByVal x As Integer)As BooleanIf() Thenjudge=TrueElsejudge=FalseEnd IfEnd Function

参考答案:

p=j*j;j=int(sqr(i))+1 或j>int(sqr(i));int(sqr(x))=sqr(x)

计算机考试