program nhap_tinhtong;
uses crt;
type kmang=array[1..1000] of integer;
var A:kmang;
n:integer;
{---Nhap---}
procedure nhap;
var i:integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']= '); readln(A[i]);
end;
end;
{---Tinh-tong---}
function tinh_tong(A:kmang; n:integer):integer;
var t,i:integer;
begin
t:=0;
for i:=1 to n do
t:=t+A[i];
tinh_tong:=t;
end;
{---CT-chinh---}
BEGIN
clrscr;
nhap;
write('Tong cac phan tu la: ',tinh_tong(A,n));
readln;
end.
program nhap_tinhtong;
uses crt;
type kmang=array[1..1000] of integer;
var A:kmang;
n:integer;
{---Nhap---}
procedure nhap;
var i:integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']= '); readln(A[i]);
end;
end;
{---Tinh-tong---}
function tinh_tong(A:kmang; n:integer):integer;
var t,i:integer;
begin
t:=0;
for i:=1 to n do
t:=t+A[i];
tinh_tong:=t;
end;
{---CT-chinh---}
BEGIN
clrscr;
nhap;
write('Tong cac phan tu la: ',tinh_tong(A,n));
readln;
end.