uses crt; var n,i,j,t:longint; a:array[1..10000000]of longint; begin clrscr; write(‘Nhap so n: ‘);readln(n); for i:=1 to n do begin write(‘Nhap phan tu thu ‘,i,’: ‘);read(a[i]); for j:=1 to i do if a[i]<a[j] then begin t:=a[i]; a[i]:=a[j]; a[j]:=t; end; end; for i:=1 to n do write(a[i],’ ‘); readln end.
program tang_dan;
uses crt;
var A:array[1..1000] of integer;
n,i,j,tg:integer;
begin
clrscr;
write(‘Nhap N: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if A[i]>A[j] then
begin
tg:=A[i];
A[i]:=A[j];
A[j]:=tg;
end;
write(‘Mang sap xep tang dan la: ‘);
for i:=1 to n do write(A[i],’ ‘);
readln;
end.
uses crt;
var n,i,j,t:longint; a:array[1..10000000]of longint;
begin
clrscr;
write(‘Nhap so n: ‘);readln(n);
for i:=1 to n do
begin
write(‘Nhap phan tu thu ‘,i,’: ‘);read(a[i]);
for j:=1 to i do
if a[i]<a[j] then
begin t:=a[i]; a[i]:=a[j]; a[j]:=t; end;
end;
for i:=1 to n do write(a[i],’ ‘);
readln
end.