Private Sub Command1_Click()
Dim i As Integer, m As Integer, n As Integer
Label1.Caption = "1000以内的完全数如下:"
For i = 1 To 1000
n = 0
For m = 1 To i \ 2
If i Mod m = 0 Then n = n + m
Next
If n = i Then Label2.Caption = Label2.Caption & "" & Str(i)
Next i
End Sub
该过程采用的算法是( )
5*5=25
6*6=36
25*25=625
76*76=5776
……
那么,5、6、25、76 等数被称为自守数。小袁编写一个 VB 程序,实现如下功能:找出 10000 以内所有可能的自守数,单击“统计”按钮 Command1,将符合要求的自守数显示在列表框 List1 中,统计个数显 示在标签 Label1 中,运行界面如图所示。
Private Sub Command1_Click()
Dim n As Single, k As Integer, t As Integer, c As Integer
List1.Clear c=0
For n = 5 To 10000
k = Len(Trim(n)) 'Trim( )函数用于删除字符串前后的空格
t = (n * n) Mod ①
If t = n Then
List1.AddItem Str(n)
②
End If
Next n
Label1.Caption = "自守个数为:" + Str(c)
End Sub
为实现上述功能,划线处应填入的代码分别为