回覆列表
  • 1 # 是謎團呀

    Function jc(ByVal n As Integer) As Long Dim i As Long jc = 1 For i = 1 To n jc = jc * i Next End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i, n As Integer Dim s As Long = 0 n = Val(InputBox("求1至n的階乘,請輸入n的值", "n值")) If (n > 12) Then MsgBox("n的值應不大於12,請重新輸入") Exit Sub End If For i = 1 To n s = s + jc(i) Next i MsgBox("階乘之和 = " & Str(s)) End Sub

  • 2 # pzyyo24296

    Private Sub Command1_Click()Dim n As Integern = InputBox("N=")f = 1For i = 2 To nf = f * iNext iMsgBox (n & "!=" & f)End Sub

  • 中秋節和大豐收的關聯?
  • 還記得你第一部手機嗎?