100-1000之间的质数的个数及其和(75067 143个)Private Sub Command1_Click()Dim x As Integer,flag As Boolean,n As Integer,s As Long,k as integerFor x = 100 To 1000flag = Truen = 2While n < xIf x Mod n = 0 Thenflag = FalseEnd Ifn = n + 1Wen
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/11 13:35:26
100-1000之间的质数的个数及其和(75067 143个)Private Sub Command1_Click()Dim x As Integer,flag As Boolean,n As Integer,s As Long,k as integerFor x = 100 To 1000flag = Truen = 2While n < xIf x Mod n = 0 Thenflag = FalseEnd Ifn = n + 1Wen
100-1000之间的质数的个数及其和(75067 143个)
Private Sub Command1_Click()
Dim x As Integer,flag As Boolean,n As Integer,s As Long,k as integer
For x = 100 To 1000
flag = True
n = 2
While n < x
If x Mod n = 0 Then
flag = False
End If
n = n + 1
Wend
If flag Then
k = k + 1
s = s + x
End If
Next
Print "100-1000之间的素数之和为"; s
Print k
End Sub
100-1000之间的质数的个数及其和(75067 143个)Private Sub Command1_Click()Dim x As Integer,flag As Boolean,n As Integer,s As Long,k as integerFor x = 100 To 1000flag = Truen = 2While n < xIf x Mod n = 0 Thenflag = FalseEnd Ifn = n + 1Wen
恩,对的