Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Untitled
SUBMITTED BY:
Guest
DATE:
May 10, 2015, 4:15 p.m.
FORMAT:
Text only
SIZE:
578 Bytes
Raw
Download
Tweet
HITS:
838
Go to comments
Report
USES crt;
VAR a,b:ARRAY[1..1000] OF LONGINT;
i,j,n,k,l,tg:LONGINT;
PROCEDURE Doicho;
BEGIN
tg:=a[j];
a[j]:=a[j+1];
a[j+1]:=tg;
END;
BEGIN
Write('Nhap n : ');
Readln(n);
FOR i:=1 TO n DO
BEGIN
Write('a',i,' : ');
Readln(a[i]);
END;
FOR i:=1 TO n-1 DO
FOR j:=1 TO n-1 DO
IF a[j] > a[j+1] THEN
doicho;
k:=0;l:=n;
FOR i:=1 TO n DO
IF a[i] MOD 2 <> 0 THEN
BEGIN
inc(k);
b[k]:=a[i];
END ELSE
BEGIN
dec(l);
b[l]:=a[i];
END;
FOR i:=1 TO n DO
Write(b[i]:3);
Readln;
END.
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus