新手请教:这段程序中x怎么会等于10,是从s=s(n-1)+n这公式计算出的?怎么算出的没搞懂?
Function s(n As Integer) As IntegerIf n = 1 Then
s = 1
Else
s = s(n - 1) + n
End If
End Function
Private Sub form_click()
Dim x As Integer
x = s(4)
Print x
End Sub
正确答案是:x=10
而对于我这个生手,真有点不太清楚这程序的计算过程?求高手指教,谢谢了!