📄 求素数.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3075
ClientLeft = 60
ClientTop = 465
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3075
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "计算"
Height = 375
Left = 3480
TabIndex = 1
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
Height = 1815
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 480
Width = 2775
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Private Sub Command1_Click()
Dim Prime(50) As Integer, i As Integer, j As Integer, m As Integer
Prime(1) = 2
m = 1
For i = 3 To 99 Step 2
For j = 2 To Sqr(i)
If i Mod j = 0 Then Exit For
Next j
If j > Sqr(i) Then
m = m + 1
Prime(m) = i
End If
Next i
j = 0
For i = 1 To m
j = j + 1
Text1 = Text1 & Prime(i) & " "
If j Mod 5 = 0 Then Text1 = Text1 & Chr(13) & Chr(10)
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -