a是循环变量,b是初始值,c是步进数,即每循环一次a的值的变化量.
n=Inputbox("n=")
i=0
s=0
For i =0 to n
i=i+1
s=s+i
Next i
Print s
Private Sub Command1_Click()
Dim i As Integer
Dim a(0 to 9)
Dim b '最大值
Dim c '最小值
Dim s '和
Dim d '平均值
b = 0
c = 0
s = 0
For i = 0 to 9
a(i)=inputbox("输入数字")
If b < a(i) Then b = a(i)
If c > a(i) Then c = a(i)
s = s + a(i)
Next i
s = s - b - c
d = s / 8
Print d
End Sub