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

2024年11月18日 15:50
有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