自己苦思冥想多时,不得其解!望各位赐教!
问题是这样的:
随机产生0-20个数,建立一个有6个数据的等差数列,count用来记录试验次数。一旦形成等差数列,则打印输出,同时结束程序运行
private sub command1_click()
count n =6
dim a%(n),i%,count&,d%
randomize timer
do while true
for i = 1 to n
a(i)=rnd*20
next i
count = count +1
d=a(2)-a(1)
for i = 1 to n
if a(i)-a(i-1) <> d then exit for
next i
if ______________________________ then
for i = 1 to n
?a(i);
?count
_________________
end if
loop
end sub
题中划线的地方,却想不出正解
[求助] 关于一个等差数列的问题