新概念英语第一册课:VB高手帮帮忙

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 02:46:34
输出2~1000内的素数
怎么编啊
Private Sub Form_click()
Dim i As Integer, n As Integer
For i = 2 To 1000
If i = 2 Or 3 Then
Print i
Else
For n = 2 To Sqr(i)
If i Mod n <> 0 Then Exit For
Next n
Print i
Next i
End Sub
这个哪里错了啊

5分太少了,不过我在你的另外一个里面全面回答了,应该没有任何问题了

http://zhidao.baidu.com/question/5650312.html

Private Sub Form_click()
Dim i As Integer, n As Integer

For i = 2 To 1000
If i = 2 Or 3 Then
Print i
Else
For n = 2 To Sqr(i)
If i Mod n <> 0 Then
Exit For
End If
Next n
Print i
End If
Next i
End Sub