Program z1; var a:array[1..10] of byte; i,j,k,r:byte; begin randomize; for i:=1 to 10 do begin a[i]:=random(100); write(a[i],' '); a[i]:=(a[i] div 10)+(a[i] mod 10) end; k:=1;writeln(''); for j:=0 to 18 do begin i:=k; while i<=10 do begin if a[i]=j then begin r:=a[k];a[k]:=a[i];a[i]:=r; write(a[k],' ') end; i:=i+1 end end; readln end.
var a:array[1..10] of byte;
i,j,k,r:byte;
begin
randomize;
for i:=1 to 10 do begin
a[i]:=random(100);
write(a[i],' ');
a[i]:=(a[i] div 10)+(a[i] mod 10)
end;
k:=1;writeln('');
for j:=0 to 18 do begin
i:=k;
while i<=10 do begin
if a[i]=j then begin
r:=a[k];a[k]:=a[i];a[i]:=r;
write(a[k],' ')
end;
i:=i+1
end
end;
readln
end.