爱吃炒土豆丝吧 关注:8贴子:214
  • 2回复贴,共1
判断素数
Private Sub Command1_Click()
Dim s As Integer, k As Integer
s = CInt(Text1)
For k = 2 To Sqr(s)
If s Mod k = 0 Then
Exit For
End If
Next k
If k > Sqr(s) Then
Text2 = s & "是素数"
Else
Text2 = s & "不是素数"
End if
End sub


IP属地:江苏1楼2015-09-21 22:42回复
    计算机编程?吧主是程序猿?


    来自Android客户端2楼2016-01-24 20:34
    收起回复