vb 编程 找出100到200之间的所有素数
1个回答
展开全部
Private Sub Form_Click()
Dim i As Integer, j As Integer, flag As Integer, a As Integer
For i = 100 To 200
j = Int(Sqr(i))
a = 2
flag = 1
Do While a <= j And flag = 1
If i Mod a = 0 Then flag = 0 Else a = a + 1
Loop
If flag = 1 Then
Text1.Text = Text1.Text & Str(i) & Chr(13) & Chr(10)
End If
Next i
End Sub
Dim i As Integer, j As Integer, flag As Integer, a As Integer
For i = 100 To 200
j = Int(Sqr(i))
a = 2
flag = 1
Do While a <= j And flag = 1
If i Mod a = 0 Then flag = 0 Else a = a + 1
Loop
If flag = 1 Then
Text1.Text = Text1.Text & Str(i) & Chr(13) & Chr(10)
End If
Next i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询