Private Sub Form_Click()
Cls
Dim a(1 To 100)
j = 0
sum = 0
Print "生成的整数:"
For i = 1 To 100
a(i) = Int(101 * Rnd + 100)
Print a(i),
j = j + 1
If (j = 5) Then
Print
j = 0
End If
Next
j = 0
Print "生成的数中的素数:"
For i = 1 To 100
If (sushu(a(i))) Then
sum = sum + a(i)
Print a(i),
j = j + 1
If (j = 5) Then
Print
j = 0
End If
End If
Next
Print
Print "产生的素数的和为:" & sum
End Sub
Function sushu(n) As Boolean
For i = 2 To n - 1
If n Mod i = 0 Then Exit For
Next i
If i = n Then
sushu = True
Else
sushu = False
End If
End Function
请采纳