Lời giải :
progam hotrotinhoc;
var a: array[1..32000] of integer ;
i,n,dem1,dem2 : integer ;
begin
write('n='); readln(n);
writeln('Nhap gia tri cua cac phan tu');
for i:= 1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
dem1:=0; dem2:=0;
for i:= 1 to n do
begin
if a[i]>0 then dem1:=dem1+1;
if a[i]>0 then dem1:=dem2+1;
end;
write('Cac so nguyen am trong day la:',dem1);
writeln;
write('Cac so nguyen am trong day la:',dem2);
readln
end.
uses crt;
var n,i,d,d1 : integer; a : array[1..100] of integer;
begin clrscr;
d:=0;d1:=0;
write('Nhap n :'); readln(n);
for i:=1 to n do begin
write('Nhap a[',i,']='); readln(a[i]); end;
for i:=1 to n do if a[i]>0 then d:=d+1 else d1:=d1+1;
write('Co ',d,' so duong'); write('Co',d1,' so am');
readln
end.