const
n = 5;
var
a: array[1..n, 1..n] of integer;
k, c, i, j: integer;
begin
c := 1;
k := 1;
while c <= n do
for i := 1 to n do
a[c, i] := k;
k := k + 1;
end;
c := c + 1;
if c>n then break;
for i := n downto 1 do
for j := 1 to n do
write(a[i, j]:3);
writeLn;
end.
const
n = 5;
var
a: array[1..n, 1..n] of integer;
k, c, i, j: integer;
begin
c := 1;
k := 1;
while c <= n do
begin
for i := 1 to n do
begin
a[c, i] := k;
k := k + 1;
end;
c := c + 1;
if c>n then break;
for i := n downto 1 do
begin
a[c, i] := k;
k := k + 1;
end;
c := c + 1;
end;
for i := 1 to n do
begin
for j := 1 to n do
write(a[i, j]:3);
writeLn;
end;
end.