编程输入如下图案 pascal repeat语句

1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 11 2 3 4 5 4 3 2 1 1 2 3 4 3 2 1 1 2 3 2 1 1 2 1 1第一行打错了,应组成菱形
2024-12-17 08:25:38
推荐回答(2个)
回答1:

var i,j,k,n:integer;
begin
write('N='); readln(n);
for i:=1 to n do
begin
write('':n-i);
for j:=1 to i do write(j);
for j:=i-1 downto 1 do write(j);
writeln;
end;
for i:=n-1 downto 1 do
begin
write('':n-i);
for j:=1 to i do write(j);
for j:=i-1 downto 1 do write(j);
writeln;
end;
end.

回答2:

var  nimqiquyj4k:integer;procedure shuchu(k:integer);  var i:integer;begin    for i:=1 to n-k do write(' ');for i:=1 to k do write(i);for i:=k-1 downto 1 do write(i);writeln;end;begin  readln(n);  for k:=1 to n do    shuchu(k);  for k:=n-1 downto 1 do    shuchu(k);end.