当前位置: 高中信息技术 / 单选题
  • 1. (2020·杭州模拟) 有VB程序段:

    Function c(m As Integer, n As Integer) As Long

      If n= m Then

        c=1

      Else

        If n=1Then c= m Else c=c(m-1, n-1)*m\n

      End If

    End Function

    Private Sub Command1_Click()

      Dim k As Integer, i As Integer, sum As Long

      k = Val (Text1. Text): sum= 0

      For i= 2 To k

        sum=sum+c(k,i)

      Next i

      Text2. Text = Str (sum)

    End Sub

    在文本框Text1中输入3,执行该程序段,则文本框Text2中显示的内容是(  )

    A . 2 B . 6 C . 4 D . 8

微信扫码预览、分享更方便