当前位置: 高中信息技术 / 单选题
  • 1. (2017·杭州模拟) 【加试题】阶乘是基斯顿﹒卡曼于1808年发明的运算符号。正整数n的阶乘为n!=1×2×3…×n。小王编写了如下VB程序用来求S=1!+2!+3!+…+10!。

      Function fac(n As Integer) As Long

        fac = 1

        For i = 1 To n

    fac = fac * i

        Next i

    End Function

    Private Sub Command1Click()

    Dim s  As Long, j As Integer

    For j = 1 To 10

    Next

    Text1.Text = Str(s)

    End Sub

     方框中的正确语句是:(   )

    A . s = s + fac(j) B . s = fac(j) C . s = s + i * fac(i) D . s = s + fac(i)

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