题型:综合题 题类:常考题 难易度:普通
浙江省杭州市长征中学2018-2019高一下学期信息技术期末考试试卷
图a |
图b |
Private Sub Command1_Click()
Dim n As Integer, i As Integer
Dim flag As Boolean ‘用于标记是否为素数
Randomize
n = Int () *2+1
Text1.Text = Str(n)
flag = True ‘标记为素数
i = 3
Do While i <= n - 1 And flag = True
If n Mod i = 0 Then
flag = False
End If
i = i + 2
Loop
If Then
Text2.Text = Str(n) + “是素数”
Else
Text2.Text = Str(n) + “不是素数”
End If
End Sub
试题篮