program tbc; uses crt; var a: array [1..100] of integer; i,s,n: longint; begin clrscr; write(‘Nhap so phan tu cua mang A: ‘); readln(n); for i:=1 to n do begin write(‘A[‘,i,’]: ‘); readln(a[i]); s:=s+a[i]; end; writeln(‘TBC cua mang: ‘,s/n:0:3); readln; end.
uses crt;
var A:array [1..1000] of integer;
i,n:integer; S:real;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap phan tu thu ‘,i,’: ‘);
readln(A[i]);
S:=S+A[i];
end;
S:=S/n;
writeln(‘Trung binh cong la: ‘,S:4:2);
readln
end.
program tbc;
uses crt;
var a: array [1..100] of integer;
i,s,n: longint;
begin
clrscr;
write(‘Nhap so phan tu cua mang A: ‘); readln(n);
for i:=1 to n do
begin
write(‘A[‘,i,’]: ‘); readln(a[i]);
s:=s+a[i];
end;
writeln(‘TBC cua mang: ‘,s/n:0:3);
readln;
end.