VB题目。点击窗体显示10到100间的所有质数,要求每行显示10个,用循环的语句编写代码。急!

2024-12-15 10:27:02
推荐回答(1个)
回答1:

Private Sub Form_Click()
Dim n As Integer, i As Integer, j As Integer, m As Integer
For n = 11 To 99 Step 2
For i = 2 To n - 1
If n Mod i = 0 Then Exit For
Next i
If n = i Then
Print n;
j = j + 1
If j > 9 Then j = 0: Print
End If
Next n
End Sub