请问VB语言中怎么求1到1000的素数分别有哪些
答案:2 悬赏:0 手机版
解决时间 2021-11-11 07:21
- 提问者网友:浪荡绅士
- 2021-11-11 04:32
请问VB语言中怎么求1到1000的素数分别有哪些
最佳答案
- 五星知识达人网友:山君与见山
- 2021-11-11 04:40
Private Sub Command1_Click()
Dim a As Long
Dim i As Long
Dim k As Long
Dim t
For i = 2 To 1000
t = 0
For k = 2 To i - 1
If i Mod k = 0 Then
t = 1
End If
Next
If t = 0 Then
Print i;
a = a + 1
If a Mod 20 = 0 Then
Print
End If
End If
Next
End Sub
Dim a As Long
Dim i As Long
Dim k As Long
Dim t
For i = 2 To 1000
t = 0
For k = 2 To i - 1
If i Mod k = 0 Then
t = 1
End If
Next
If t = 0 Then
Print i;
a = a + 1
If a Mod 20 = 0 Then
End If
End If
Next
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯