用pascal语句打印下列图形: 1 121 12321 1234321 12321 121 1

用pascal语句打印下列图形: 1 121 12321 1234321 12321 121 1
2024-12-23 04:44:12
推荐回答(2个)
回答1:

能用麻溜结贴,不能用继续追问。
program PrintTriangle;
const
LEVEL = 4;
var
row, col, max, num: Longint;
begin
max := 0;
for row := 1 to LEVEL * 2 - 1 do
begin
if row <= LEVEL then Inc(max)
else Dec(max);
Write(' ':LEVEL - max + 1);
num := 0;
for col := 1 to max * 2 - 1 do
begin
if col <= max then Inc(num)
else Dec(num);
Write(num);
end;
Writeln;
end;
Readln;
end.

回答2:

writeln( 1 121 12321 1234321 12321 121 1);