mình thấy ở trang 71 SGK có bài tương tự
program Tinh_trung_binh_cong;
uses crt;
var n, dem : integer;
a, TB : real;
begin clrscr;
dem:= 0; TB:=0;
write('Nhap so cac so can tinh n = '); realn(n);
write dem < n do
begin dem:= dem + 1;
write('Nhap so thu ', dem,' = '); realn(a);
TB:= TB + a;
end;
TB:= TB/n;
writeln('Trung binh cua ', n, ' so la = ', TB:10:3);
writeln('Nhan Enter de thoat ...');
readln;
end.
program Tinh_trung_binh_cong;
uses crt;
var n, dem : integer;
a, TB : real;
begin clrscr;
dem:= 0; TB:=0;
write('Nhap so cac so can tinh n = '); realn(n);
write dem < n do
begin dem:= dem + 1;
write('Nhap so thu ', dem,' = '); realn(a);
TB:= TB + a;
end;
TB:= TB/n;
writeln('Trung binh cua ', n, ' so la = ', TB:10:3);
writeln('Nhan Enter de thoat ...');
readln;
end.