const
n = 3;
var
a: Array[1..n, 1..n] of Integer;
j, i, s: integer;
begin
Randomize;
Writeln('Случайная матрица:');
for i := 1 to n do
begin
for j := 1 to n do
begin
a[i, j] := Random(51) - 25;
Write(a[i, j]:5);
end;
Writeln
end;
for i := 1 to n do
begin
j := n + 1 - i;
s := s + a[i, j];
end;
Writeln('Сумма элементов побочной диагонали: ', s);
Readln
end.