vb素数经典编程.docVIP

  • 17
  • 0
  • 约1.58千字
  • 约 3页
  • 2018-04-17 发布于河南
  • 举报
vb素数经典编程

Private Sub Command1_Click() Dim n As Integer Dim i As Integer Dim f As Boolean n = Val(Text1.Text) f = True For i = 2 To n - 1 If n Mod i = 0 Then f = False End If Next If f = True Then Text2.Text = 素数 Else Text2.Text = 不是素数 End If End Sub Private Sub Command1_Click() Dim n As Integer Dim i As Integer Dim f As Boolean n = Val(Text1.Text) f = True For i = 2 To n - 1 If n Mod i = 0 Then f = False Next If f Then Text2.Text = 素数 Else Text2.Text = 不是素数

文档评论(0)

1亿VIP精品文档

相关文档