BT:
1)
uses crt;
var i,n,s: integer;
begin
clrscr;
write ('nhap n: '); readln (n);
for i:=1 to n do
s:=s+i;
write ('cac so le tu 1-n la: ');
for i:=1 to n do if i mod 2<>0 then write (i,' ');
writeln;
write ('cac so chan tu 1-n la: ');
for i:=1 to n do if i mod 2=0 then write (i,' ');
writeln;
writeln ('tong cac so tu 1-n la: ',s);
readln;
end.
2)
uses crt;
var a: array[1..100] of integer;
i,n,min,max,j,t: integer;
begin
clrscr;
write ('nhap so luong phan tu: '); readln (n);
for i:=1 to n do
begin
write ('nhap pt thu ',i,': '); readln (a[i]);
end;
min:=a[1];
max:=a[1];
for i:=2 to n do
begin
if min>a[i] then min:=a[i];
if max<a[i] then max:=a[i];
end;
writeln ('so lon nhat: ',max);
writeln ('so be nhat: ',min);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
write ('day tang dan la: ');
for i:=1 to n do write (a[i],' ');
readln;
end.