VisualBasic³ÌÐòÉè¼Æ¡ªÊµÑ鱨¸æ²á-²Î¿¼´ð°¸ ÏÂÔØ±¾ÎÄ

Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() Dim n, sum As Integer n = Val(InputBox(\sum = jsh(n)

Print \End Sub

Public Function jsh(n) As Integer Dim i, s, t As Integer s = 0 t = 1

For i = 1 To n t = t * i s = s + t Next i jsh = s

End Function

VERSION 5.00

Begin VB.Form Form1

AutoRedraw = -1 'True Caption = \ ClientHeight = 3555 ClientLeft = 60 ClientTop = 450 ClientWidth = 5760 LinkTopic = \ ScaleHeight = 3555 ScaleWidth = 5760

StartUpPosition = 3 '´°¿Úȱʡ Begin VB.CommandButton Command1 Caption = \ Height = 495 Left = 3600 TabIndex = 0 Top = 2280 Width = 1215 End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True Attribute VB_Exposed = False

Private Sub Command1_Click() Dim n, flag As Integer

n = Val(InputBox(\ÊäÈëÈÎÒâÒ»¸öÊý\sushu n, flag

Print n; \µÄ±êÖ¾ÊÇ\End Sub

Public Sub sushu(n, flag) flag = 1

For i = 2 To n - 1

If n Mod i = 0 Then flag = 0: Exit For Next i End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 4305 ClientLeft = 60 ClientTop = 450 ClientWidth = 6945 BeginProperty Font

Name = \ºÚÌå\ Size = 26.25 Charset = 134 Weight = 700

Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty

LinkTopic = \ ScaleHeight = 4305 ScaleWidth = 6945

StartUpPosition = 3 '´°¿Úȱʡ Begin VB.CommandButton Command1 Caption = \ Height = 615 Left = 3960 TabIndex = 0 Top = 3360

Width = 2775 End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Command1_Click() n = InputBox(\ÈÎÒâÊäÈëÒ»¸öÊý\

If hws(n) = True Then Print n; \ÊÇ\²»ÊÇ\End Sub

Function hws(x) As Boolean Print x hws = True

For i = 1 To Len(x) \\ 2

If Mid(x, i, 1) <> Mid(x, Len(x) + 1 - i, 1) Then hws = False Exit For End If Next i

End Function VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 3660 ClientLeft = 60 ClientTop = 450 ClientWidth = 5895 BeginProperty Font

Name = \ºÚÌå\ Size = 24 Charset = 134 Weight = 700

Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty

LinkTopic = \ ScaleHeight = 3660 ScaleWidth = 5895

StartUpPosition = 3 '´°¿Úȱʡ Begin VB.CommandButton Command2 Caption = \¹ý³ÌÐÎʽ\

BeginProperty Font

Name = \ËÎÌå\ Size = 18 Charset = 134 Weight = 700

Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty

Height = 615 Left = 3600 TabIndex = 1 Top = 2760 Width = 1935 End

Begin VB.CommandButton Command1 Caption = \º¯ÊýÐÎʽ\ BeginProperty Font

Name = \ËÎÌå\ Size = 18 Charset = 134 Weight = 700

Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty

Height = 615 Left = 600 TabIndex = 0 Top = 2760 Width = 1935 End End

Attribute VB_Name = \

Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False

Rem ÀûÓú¯Êý¹ý³ÌÇó n!/(m!.(n-m)!) Function fact2(x) t = 1

For i = 1 To x t = t * i Next i

fact2 = t End Function

Private Sub Command1_Click() m = Val(InputBox(\ÊäÈë N\ n = Val(InputBox(\ÊäÈë M\ s1 = fact2(n) s2 = fact2(m) s3 = fact2(n - m)

Print \º¯Êý·¨½á¹ûΪ\End Sub

Rem ÀûÓÃ×Ó³ÌÐò¹ý³ÌÇó n!/(m!.(n-m)!) Sub fact1(ByVal x As Integer, t) t = 1

For i = 1 To x t = t * i Next i End Sub

Private Sub Command2_Click() m = Val(InputBox(\ n = Val(InputBox(\ fact1 n, s1 fact1 m, s2

fact1 n - m, s3

Print \×Ó¹ý³Ì½á¹û\End Sub

VERSION 5.00

Begin VB.Form Form1

Caption = \ ClientHeight = 3090 ClientLeft = 60 ClientTop = 450 ClientWidth = 4680 LinkTopic = \ ScaleHeight = 3090 ScaleWidth = 4680

StartUpPosition = 3 '´°¿Úȱʡ Begin VB.CommandButton Command1 Caption = \ Height = 495