Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Bài 1
SUBMITTED BY:
Guest
DATE:
May 10, 2015, 1:02 p.m.
FORMAT:
Text only
SIZE:
544 Bytes
Raw
Download
Tweet
HITS:
1071
Go to comments
Report
USES crt;
VAR a,b:ARRAY[1..1000] OF LONGINT;
i,j,n,k,l,tg:LONGINT;
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
begin
tg:=a[j];
a[j]:=a[j+1];
a[j+1]:=tg;
END;
k:=0;l:=n+1;
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