📄 求素数.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2310
ClientLeft = 60
ClientTop = 420
ClientWidth = 7500
LinkTopic = "Form1"
ScaleHeight = 2310
ScaleWidth = 7500
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "点击查看10到100间的素数"
Height = 615
Left = 2280
TabIndex = 1
Top = 1440
Width = 2775
End
Begin VB.TextBox Text1
Alignment = 2 'Center
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 7095
End
Begin VB.Label Label1
Alignment = 2 'Center
Height = 495
Left = 240
TabIndex = 2
Top = 720
Width = 7095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim flag As Integer
For i = 10 To 100 Step 1
flag = 1
For j = 2 To i - 1 Step 1
If i Mod j = 0 Then
flag = 0
Exit For
End If
Next j
If flag = 1 Then
n = n + 1
Text1.Text = Text1.Text + Str(i)
End If
Next i
Label1.Caption = "在10到100中,一共有" + Str(n) + "个素数!"
End Sub
Private Sub Form_Load()
Text1.Text = " "
n = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -