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.
*chỗ tb mình lấy 2 số lẻ thập phân nha
uses crt;
var n, dem:integer;
x,TB:real;
begin
clrscr;
dem:=0;TB:=0;
write('Nhap so cac so can tinh n = ');
readln(n);
while dem<n do
begin
dem:=dem+1;
write('Nhap so thu ',dem,'= ');readln(x);
TB:=TB+x;
end;
TB:=TB/n;
writeln('Trung binh cua',n,' so la = ',TB:10:3);
readln;
end.