用VB语言编一段求200到300之间所有素数的程序
答案:1 悬赏:30 手机版
解决时间 2021-08-11 16:49
- 提问者网友:临风不自傲
- 2021-08-11 06:34
急需!
最佳答案
- 五星知识达人网友:患得患失的劫
- 2021-08-11 08:10
Private Sub Command1_Click()
Dim i As Integer
For i = 200 To 300 If IsShu(i) = True Then Debug.Print i
Next
End Sub
Private Function IsShu(IntTmp As Integer) As Boolean
IsShu = False
For i = 2 To Sqr(IntTmp) + 1 If IntTmp Mod i = 0 Then IsShu = False Exit Function End If
Next
IsShu = True
End Function
Dim i As Integer
For i = 200 To 300 If IsShu(i) = True Then Debug.Print i
Next
End Sub
Private Function IsShu(IntTmp As Integer) As Boolean
IsShu = False
For i = 2 To Sqr(IntTmp) + 1 If IntTmp Mod i = 0 Then IsShu = False Exit Function End If
Next
IsShu = True
End Function
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯