用VB求出100以内的素数后要求每十个一行输出,该怎么写程序?

2024-11-18 15:50:39
推荐回答(1个)
回答(1):

Dim i As Integer, n As Integer ,m as integer
For i = 1 To 100
For n = 2 To i - 1
If i Mod n = 0 Then Exit For
Next n
If n = i Then
Print i;
m=m+1
If m Mod 10 = 0 Then Print
end if
Next i