vb编写程序求100到300之间的所有素数
vb编写程序求100到300之间的所有素数
日期:2020-06-22 21:44:42 人气:1
rivate Function IsPrime(ByRef n As Integer) As Boolean '。此函数用于判断一个数是否素数:
Dim j As Integer ;
IsPrime = True ;
For j = 2 To n - 1 ;
If n Mod j = 0 Then IsPrime = False: Exit For ;
Next ;
End Function用法dim i as integer ,n as integerfor i =100 to 300if Is