===== PascalABC.NET =====
begin
var (m, n) := ReadInteger2;
var a := MatrRandom(m, n, -99, 99);
a.Println;
Writeln;
a.Transform(p -> p <= 0 ? 0 : 1);
a.Println
end.
var
A: array[1..100, 1..100] of integer;
i, j,n,m: integer;
Writeln('Введите N and M');
Read(n,m);
Randomize;
Writeln('Исходная матрица');
for i := 1 to N do
for j := 1 to M do
a[i, j] := Random(-100, 100);
write(A[i, j]:5);
end;
writeln;
Writeln('Измененная матрица');
if A[i, j] > 0 then a[i, j] := 1;
if A[i, j] < 0 then a[i, j] := 0;
Write(a[i, j]:5);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
===== PascalABC.NET =====
begin
var (m, n) := ReadInteger2;
var a := MatrRandom(m, n, -99, 99);
a.Println;
Writeln;
a.Transform(p -> p <= 0 ? 0 : 1);
a.Println
end.
var
A: array[1..100, 1..100] of integer;
i, j,n,m: integer;
begin
Writeln('Введите N and M');
Read(n,m);
Randomize;
Writeln('Исходная матрица');
for i := 1 to N do
begin
for j := 1 to M do
begin
a[i, j] := Random(-100, 100);
write(A[i, j]:5);
end;
writeln;
end;
Writeln('Измененная матрица');
for i := 1 to N do
begin
for j := 1 to M do
begin
if A[i, j] > 0 then a[i, j] := 1;
if A[i, j] < 0 then a[i, j] := 0;
Write(a[i, j]:5);
end;
Writeln;
end;
end.