câu1. program bt1;
var
n,i,tongcacpt,demsoduong,tongsoduong,demsoam,tongsoam:integer;
tbc:real;
a:array [1..1000] of integer;
begin
writeln('-Nhap so phan tu: ');
readln(n);
for i:=1 to n do
begin
writeln('-Phan tu thu ',i,': ');
readln(a[i]);
end;
tongcacpt:=0;
for i:=1 to n do tongcacpt:=tongcacpt+a[i];
writeln('-Tong cac phan tu cua day: ',tongcacpt);
demsoduong:=0;
demsoam:=0;
tongsoduong:=0;
tongsoam:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
inc(demsoduong);
tongsoduong:=tongsoduong+a[i]
end;
if a[i]<0 then
begin
inc(demsoam);
tongsoam:=tongsoam+a[i]
end;
end;
writeln('-Day nay co ',demsoduong,' so duong co tong la: ',tongsoduong);
writeln('-Day nay co ',demsoam,' so am co tong la: ',tongsoam);
tbc:=tongcacpt/n;
writeln('-Day nay co trung binh cong la: ',tbc:4:2);
readln
end.
cau 2.