Pascal1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const nmax=20;
var a:array[1..nmax,1..nmax] of integer;
n,i,j:byte;
begin
repeat
write('Размер матрицы от 2 до ',nmax,' n=');
readln(n);
until n in [2..nmax];
writeln('Матрица');
for i:=1 to n do
begin
for j:=1 to n do
begin
if j=i then a[i,j]:=n-i+1
else a[i,j]:=0;
write(a[i,j]:3);
end;
writeln;
end;
end.