Tham khảo !
program trung_binh;
uses crt;
var n,i:integer;
tb:real;
a:array[1..100] of integer;
begin
clrscr;
write('nhap n:');readln(n);
writeln('nhap day so:');
for i:=1 to n do
begin
write('a[',i,']=');readln(a[i]);
end;
tb:=0;
for i:=1 to n do tb:=tb+a[i];
tb:=tb/n;
write('trung binh cong cua day so vua nhap la:',tb:2:2);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,tb:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln(tb/n:4:2);
readln;
end.