uses
crt;
const
n=10;
function F(n:integer):integer;
var
temp,count:integer;
begin
temp:=n;
count:=0;
while temp<>0 do
begin
inc(count,temp mod 10);
temp:=temp div 10
end;
F:=count
end;
var
a:array[1..n]of integer;
i,max,temp:integer;
begin
clrscr;
{çàäàåì âûâîäèì ñ÷èòàåì}
writeln('Èñõîäíûé ìàññèâ:');
write('[ ');
for i:=1 to n do
begin
a[i]:=random(800);
if i=1 then
max:=i;
if F(a[i])>F(a[max]) then
max:=i;
write(a[i],' ')
end;
writeln(']');
writeln('Ìàêñèìàëüíûé - a[',max,']')
end.