dim i as integer,j as variant
j=1 '不加这行 j的值默认为0 结果也就是0了.
for i = 1 to 100
j=j*i
next
msgbox j
'ps.结果很大..9E+157..
'==========================
Dim s,i As Integer
s=1
i=1
While i<=100
s=s*i
i=i+1
Wend
Print s
用一个for next循环就可以实现了
Option Explicit
Private Sub Form_Load()
Dim i As Integer '循环变量参数
Dim j As Double '由于得到结果大于long型范围,所以设为Double,也可为单精度
j = 1
For i = 1 To 100
j = j * i
Next i
Me.Print j '将Form1 的Autoredaw属性设为True
End Sub
dim i as string
dim j as integer
for j=1 to 100
i=i*j
next
text1.text=i
这是一种环循
还有几种
Dim s,i As Integer
s=_1_________
i=____1______
While i__<=100________
s=___i*(i+1)_______
i=__i+1________
Wend
Print s