Var ar:array[1..10] of integer;
max,maxi,zeroi,i:integer;
begin
randomize;
max:=-1;
writeln('First array:');
for i:=1 to 10 do
begin;
ar[i]:=random(10);
write(ar[i]:4);
if max begin;
max:=ar[i];
maxi:=i;
end;
end;
for i:=1 to 10 do
if ar[i]=0 then
begin;
zeroi:=i;
break;
end;
ar[maxi]:=zeroi;
writeln;
writeln('Final array:');
for i:=1 to 10 do
write(ar[i]:4);
end.