自定义函数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 jEnd 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)
答案:B