Bài 1:
uses crt;
var a:array[1..100]of integer;
n,i,max,j,tam,t:integer;
tbc:real;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
{------------------------------cau-a---------------------------}
for i:=1 to n do
write(a[i]:4);
{-----------------------------cau-b-----------------------------}
writeln;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('so lon nhat cua day la: ',max);
{----------------------------cau-c----------------------------}
Writeln('day khong giam cua day so la: ');
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>=a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do
write(a[i]:4);
{-------------------------------cau-d------------------------------}
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
tbc:=t/n;
writeln('gia tri trung binh cua day so la: ',tbc:4:2);
readln;
end.