题库 高中信息

题干

(加试题)有如下VB程序段:
Private Sub Command1_Click()
Dim i As Integer, s As Integer
s = 0
For i = 1 To 5 Step 3
s = s + fun(i)
Next i
Text1.Text = Str(s)
End Sub
Function fun(n As Integer) As Integer
If n = 1 Then
fun = 2
Else
fun = fun(n - 1) + n
End If
End Function
执行完该程序后,S的值为( )
A.7B.11C.13D.25
上一题 下一题 0.99难度 选择题 更新时间:2019-05-06 09:18:31

答案(点此获取答案解析)