已验证,可直接得出结果,如果想得出中间过程,可以向循环内加入?a 或者s
前提是确定是i的i次方之和
Private Sub Command1_Click()
Dim s, a, i As Single
s = 0
Cls
For i = 1 To 100
a = i ^ i
s = s + a
Next i
Print s
End Sub
dim i as long,s as long,t as long
s=0
for i=1 to 100
t=ixi
s=s+t
next i
我没验证过。不知道long的范围十分够,你也可以用double。
Private Sub Command1_Click()
Dim a(1 To 30) As Integer
Randomize
For i = 1 To 30
a(i) = int(Rnd * 90 + 9)
Print a(i);
Next
End Sub