const n=10; var a:array[1..10] of int64; i,ip:integer; p:int64; begin Randomize; p:=1; ip:=0; for i:=1 to n do begin a[i]:=Random(101)-50; Write(a[i],' '); if a[i]<0 then p:=p*a[i] else if (a[i]>0) and (ip=0) then ip:=i end; Writeln; if i>0 then begin a[ip]:=p; for i:=1 to n do Write(a[i],' '); Writeln end else Writeln('Нет положительных элементов') end.
{$APPTYPE CONSOLE}
const
n=10;
var
a:array[1..10] of int64;
i,ip:integer;
p:int64;
begin
Randomize;
p:=1; ip:=0;
for i:=1 to n do begin
a[i]:=Random(101)-50;
Write(a[i],' ');
if a[i]<0 then p:=p*a[i]
else
if (a[i]>0) and (ip=0) then ip:=i
end;
Writeln;
if i>0 then begin
a[ip]:=p;
for i:=1 to n do Write(a[i],' ');
Writeln
end
else Writeln('Нет положительных элементов')
end.