//Pascal ABC.NET 3.1 сборка 1219
Const
n=3;
Var
ma:array[1..n,1..n] of integer;
i,j:integer;
begin
randomize;
writeln('Matrix:');
for i:=1 to n do
begin
for j:=1 to n do
begin
ma[i,j]:=random(-10,10);
write(ma[i,j]:4);
if ma[i,j]>0 then ma[i,j]:=1 else ma[i,j]:=0;
end;
writeln;
end;
writeln('Final matrix:');
for i:=1 to n do
begin
for j:=1 to n do
write(ma[i,j]:4);
writeln;
end;
end.
Пример работы программы:
Matrix:
-6 1 8
1 -8 5
6 9 6
Final matrix:
0 1 1
1 0 1
1 1 1