定义3个int函数变量i,j,h
for (h=1;h++;h<=100)
for (i=1;i++;i<=h)
{j=j+i;}
j为全局变量初值为0,设立两层循环关系
两层循环完毕以后,j的最终值即为所求结果
在调用的地方AddNaturalNumber(自然数)
Private Function AddNaturalNumber(n As Integer)
Dim I As Integer
Dim Sum As Long
For I = 1 To n
Sum = Sum + n;
Next I
If n > 1 Then
Sum = Sum + AddNaturalNumber(n - 1)
End If
AddNaturalNumber = Sum
End Function
不懂啊