

{
PROGRAMMED BY   : MOHAMMAD ALJADA
DOWNLOADED FROM : WWW.GEOCITIES.COM/MOHJADA
PROGRAM         : Sort
}

USES WINCRT;

VAR ARR1:ARRAY[1..100] OF INTEGER;
    I,J,N,O,M,TMP:INTEGER;

BEGIN

     WRITE('INPUT NUMBER OF ITEMS :');
     READLN(N);
     randomize;
     FOR I:=1 TO N DO 
     arr1[i]:=random(100);

     FOR I:=1 TO N DO
     WRITE(ARR1[I]:3);

     M:=N-1;
     O:=N;
     WHILE O>1 DO
     BEGIN 

           FOR I:=1 TO M DO
           BEGIN
           IF ARR1[I]>ARR1[I+1] THEN
           BEGIN
           TMP:=ARR1[I];
           ARR1[I]:=ARR1[I+1];
           ARR1[I+1]:=TMP;
           END;
           END;
     O:=O-1;
     END;

     WRITELN;
     FOR I:=1 TO N DO
     WRITE(ARR1[I]:3);


      



END.

      