Dim i As Integer, j As Integer
Dim n As Integer, sum As Long, jc As Long
n = InputBox("请输入:") '如果是用文本框text1输入,这里改为 n=val(Text1)
sum = 0
For i = 1 To n
jc = 1
for j=1 to i
jc = jc * j
next j
sum = sum + jc
Next i
Print sum
while:
Dim i As Integer, j As Integer
Dim n As Integer, sum As Long, jc As Long
n = InputBox("请输入:")
sum = 0
i = 1
While i <= n
jc = 1
j = 1
While j <= i
jc = jc * j
j = j + 1
Wend
sum = sum + jc
i = i + 1
Wend
Print sum