1个回答
展开全部
在窗体一画一个按钮就可以。
Function chuli(ByVal old) As Integer
chuli = 1
Do While old > 1
For i = 2 To old
If old Mod i = 0 Then
chuli = chuli + i
old = old / i
If old < i Then Exit For
i = i - 1
End If
Next
Loop
End Function
Private Sub Command1_Click()
For old = 1 To 100
If Sqr(chuli(old)) = Int(Sqr(chuli(old))) Then Print old;
Next
End Sub
Function chuli(ByVal old) As Integer
chuli = 1
Do While old > 1
For i = 2 To old
If old Mod i = 0 Then
chuli = chuli + i
old = old / i
If old < i Then Exit For
i = i - 1
End If
Next
Loop
End Function
Private Sub Command1_Click()
For old = 1 To 100
If Sqr(chuli(old)) = Int(Sqr(chuli(old))) Then Print old;
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询