VB编程:输出1~100之间所有素数

来源:百度知道 编辑:UC知道 时间:2024/06/21 18:58:30
如题.

Dim a As Double
Dim b As Double
Dim c As Double
Dim d As Double
Dim t As Double
Dim Uu9 As String
Private Sub Form_Click()
a = 1
b = 100
If b > 90000 Then
daan = MsgBox("判断大于90000的数将用较长时间" + vbCrLf + " 继续吗?", 36, "询问")
If daan = vbNo Then
Exit Sub
End If
End If
If a >= b Then
t = a
a = b
b = t
'MsgBox "第一个数应比第二个数小!", 16, "数据错误"
'Exit Sub
End If
If a <= 2 Then
Uu9 = "2"
a = 2
End If
For c = a To b
bz = False
If c / 2 = c \ 2 Then
bz = True
End If

For d = 3 To Int(Sqr(c)) Step 2
If c / d = c \ d Then