BASIC语言编程用随机函数产生20个〔100,1000〕之间的整数,并按从小到大的顺序,按每行10个数的格式输出

2024-11-29 05:49:07
推荐回答(1个)
回答1:

dim a(20)
for i=1 to 20
a(i)=int(rand(1)*900)+100
next i
for i=1 to 19
for j=i+1 to 20
if a(i)>a(j)
t=a(i)
a(i)=a(j)
a(j)=t
endif
next j
next i
for i=1 to 20
print a(i);
if i mod 10=0
print
endif
next i
end