【单选题】如下程序段,要计算s=1+(1+2)+(1+2+3),已知主调程序为:Private Sub Button1_Click(…) Handles Button1.Click Dim s% = 0,i% For i = 1 To 3 s = s + sum(i) Next MsgBox(“s=” & s)End Sub如下sum函数过程及变量声明,不能实现题目要求的是 。
A.
Function sum(ByVal n%) Dim c% c = c + n sum = c End Function
B.
Function sum(ByVal n%) Static c% c = c + n sum = c End Function
C.
Public c% Function sum(ByVal n%) c = c + n sum = c End Function
D.
Dim c% Function sum(ByVal n%) c = c + n sum = c End Function