Program mass;
uses crt;
var
x:array [1..100, 1..100] of integer;
i,j,n,m:integer;
begin
clrscr;
write ('Количество строк: ');
readln (n);
write('Количество столбцов: ');
readln (m);
for i:=1 to n do
for j:=1 to m do
begin
write('Введите элемент ' ,i,j,' матрицы:');
readln(x[i,j]);
end;
for i:=1 to N do
begin
for j:=1 to M do
write (' ',x[i,j]:3);
writeln;
end;
for i:=1 to n do
for j:=1 to m do
begin
if (i <> j) then
x[i,j]:=0;
end;
writeln;
for i:=1 to N do
begin
for j:=1 to M do
write (' ',x[i,j]:3);
writeln;
end;
readln;
end.