VB编程 利用判素数函数,完成100到200之间所有素数平均值的输出?
VB编程 利用判素数函数,完成100到200之间所有素数平均值的输出?
日期:2020-04-30 15:21:13 人气:2
Private Sub Command1_Click()
Dim i As Integer, avg As Single, n As Integer
For i = 100 To 200
If pd(i) Then
n = n + 1
avg = avg + i
End If
Next
avg = avg / n
MsgBox avg
End Sub
Private Function pd(ByVal shu As Integer) As Boolea