Pagini recente » Cod sursa (job #997108) | Cod sursa (job #2871070) | Cod sursa (job #419777) | Cod sursa (job #2930227) | Cod sursa (job #344297)
Cod sursa(job #344297)
PROGRAM SORTAREA;
VAR V:ARRAY[1..100]OF INTEGER;
N,I,AUX:LONGINT;
OK:BOOLEAN;
BEGIN
WRITE('N=');READLN(N);
FOR I:=1 TO N DO BEGIN
WRITE('V[',I,']=');READLN(V[I]);
END;
REPEAT
OK:=FALSE;
FOR I:=1 TO N-1 DO
IF V[I]>V[I+1] THEN BEGIN
AUX:=V[I];
V[I]:=V[I+1];
V[I+1]:=AUX;
OK:=TRUE; END;
UNTIL NOT OK;
FOR I:=1 TO N DO WRITE(V[I],' ');
END.