var f:array[1..15] of integer;
i:integer;
begin
randomize;
for i:=1 to 15 do
f[i]:=random(-18,37);
if f[i]<0 then f[i]:=0;
write(f[i],' ');
end;
end.
Объяснение:
34 0 0 4 25 4 0 0 25 0 36 4 0 36 25
===== PascalABC.NET =====
var a := ArrRandom(15, -18, 37);
a.Println;
a.Transform(p -> p < 0 ? 0 : p);
a.Print
var f:array[1..15] of integer;
i:integer;
begin
randomize;
for i:=1 to 15 do
begin
f[i]:=random(-18,37);
if f[i]<0 then f[i]:=0;
write(f[i],' ');
end;
end.
Объяснение:
34 0 0 4 25 4 0 0 25 0 36 4 0 36 25
===== PascalABC.NET =====
begin
var a := ArrRandom(15, -18, 37);
a.Println;
a.Transform(p -> p < 0 ? 0 : p);
a.Print
end.