Option Explicit
Private Sub Command1_Click()
Cls
Dim i As Integer, Sum As Integer
Dim a(10) As Integer
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 1000) + 1
Sum = Sum + a(i)
Next i
Print Sum
End Sub
2.
Private Sub Command1_Click()
Cls
Dim a(10) As Integer
Dim x As Integer
x = 1
While x <= 10
a(x) = Int(Rnd * 1000)
x = x + 1
Wend
sum = 0
x = 1
While x <= 10
sum = sum + a(x)
x = x + 1
Wend
Print sum
End Sub