// PascalABC.NET 3.0, сборка 1144 от 16.01.2016 begin var n:=ReadInteger('Количество элементов='); var b:=ArrRandomReal(n,-10,20); b.Println(', '); var mx:=b.Max; var c:=b.Where(x->x<>mx); c.Println(', ') end.
Var ar,ar2:array[1..10] of integer; i:integer; begin randomize; writeln('First array:'); for i:=1 to 10 do begin; ar[i]:=random(10)-3; write(ar[i]:4); if ar[i]=0 then ar2[i]:=0; end; writeln; writeln('1-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]<0 then ar2[i]:=ar[i]; end; writeln; writeln('2-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]>0 then ar2[i]:=ar[i]; end; writeln; writeln('3-st Final array:'); for i:=1 to 10 do write(ar2[i]:4); end.
begin
var n:=ReadInteger('Количество элементов=');
var b:=ArrRandomReal(n,-10,20);
b.Println(', ');
var mx:=b.Max;
var c:=b.Where(x->x<>mx);
c.Println(', ')
end.
Тестовое решение:
Количество элементов= 13
-3.19967562016085, 0.998729616868649, 17.2918094030078, 1.10658910642685, 10.4760369241592, 6.72070787601206, 8.34657945593194, 12.5555840984711, 13.4678390079494, -1.30778588881147, 19.5660732731065, 18.4909354934892, 9.13206894841607
-3.19967562016085, 0.998729616868649, 17.2918094030078, 1.10658910642685, 10.4760369241592, 6.72070787601206, 8.34657945593194, 12.5555840984711, 13.4678390079494, -1.30778588881147, 18.4909354934892, 9.13206894841607
ar,ar2:array[1..10] of integer;
i:integer;
begin
randomize;
writeln('First array:');
for i:=1 to 10 do
begin;
ar[i]:=random(10)-3;
write(ar[i]:4);
if ar[i]=0 then ar2[i]:=0;
end;
writeln;
writeln('1-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]<0 then ar2[i]:=ar[i];
end;
writeln;
writeln('2-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]>0 then ar2[i]:=ar[i];
end;
writeln;
writeln('3-st Final array:');
for i:=1 to 10 do
write(ar2[i]:4);
end.