主题:[原创]矩阵
zhiaini
[专家分:10] 发布于 2009-08-24 11:49:00
*****
#***#
##*##
#***#
*****
键盘输入5
回复列表 (共2个回复)
沙发
天天和和 [专家分:1420] 发布于 2009-08-24 12:05:00
CLS
INPUT N
M = N \ 2 + 1
FOR I = 1 TO N
PRINT STRING$(M - ABS(M - I) - 1, "#");
PRINT STRING$(ABS(M - I) * 2 + 1, "*");
PRINT STRING$(M - ABS(I - M) - 1, "#");
PRINT
NEXT I
END
板凳
phile [专家分:2310] 发布于 2009-08-24 12:07:00
CLS
INPUT N
DIM A(N, N)
FOR I = 1 TO N \ 2 + 1
FOR J = I TO N + 1 - I
A(I, J) = 1: A(N + 1 - I, J) = 1
NEXT J, I
FOR I = 1 TO N
FOR J = 1 TO N
IF A(I,J)=1 THEN PRINT "*"; ELSE PRINT "#";
NEXT J
PRINT
NEXT I
我来回复