洛奇英雄传象牙武器:qbasic(打印图形)

来源:百度文库 编辑:中科新闻网 时间:2024/04/30 08:26:25
1 1 1 1 1
2 2 2 2 1
3 3 3 2 1
4 4 3 2 1
5 4 3 2 1

(1)for i=1 to 5
for j=1 to 6-i
print i
next
for k=i-1 to 1 step -1
print k
next
next
(2)for i=1 to 5
for j=1 to 5
if i+j=7 or i+j=8 or i+j=9 or i+j=10 then a(i,j)=6-j else a(i,j)=i
next j,i

两层循环呗,这么简单。
for i=1 to 5
for j=1 to 6-i
print i
next
for k=i-1 to 1 step -1
print k
next
next