试题

试题 试卷

logo

题型:单选题 题类:模拟题 难易度:困难

浙江省杭州市2016年信息技术高考模拟卷十四

自定义函数f的功能是计算自然数n的阶乘值,即f=n!。下面VB程序通过调用函数来计算S=1!+2!+3!+4!+5!+6!:

Function f(n as integer) as long

    Dim j As Integer

    f=1

    For j=1 to n

   f=f*j

    Next j

End Function

 Private Sub Command1_Click()

  Dim s As Long, AS Integer

  S=0

  For i=1 to 6

  Next i

  Text1.text=str(s)

 End Sub

方框中正确的语句是  (   )

A、s=f(i) B、s=s+f(i) C、s=f(n) D、s=s+f(n)
举一反三
返回首页

试题篮