【单选题】如下程序段,要计算s=1+(1+2)+(1+2+3),已知主调程序为:Private Sub Command1_Click() Dim s%, i% For i = 1 To 3 s = s + sum(i) Next MsgBox ("s=" & s)End Sub则下列sum函数过程正确的是__________。
A.
Function sum%(ByVal n%) Static c% c = c + n sum = c End Function
B.
Function sum%(ByVal n%) Dim c% c = c + n sum = c End Function
C.
Function sum%(ByVal n%) Public c% c = c + n sum = c End Function
D.
Function sum%(ByVal n%) Private c% c = c + n sum = c End Function