làm như sau:
program tim;
uses crt;
var n,i,j,chan,le,songuyento :integer;
A:array[1..100] of integer;
begin
clrscr;
i := 1;
chan := 0;
j := 0;
le := 0;
songuyento := 0;
writeln('ban hay nhap vao so n, n <= 100');
readln(n);
if n >= 100 and n <= 0 then
writeln('ban nhap sai, nhan 1 phim bat ki de ket thuc.')
else
begin
while (abs(a[i]) < 1000) and ( i <= n) do
begin
writeln('ban nhap vao phan tu thu ',i,'');
readln(a[i]);
i := i +1;
end;
for i = 1 to n do
begin
if a[i] mod 2 = 0 then
chan = chan +1;
else
le := le +1;
end;
for i := 1 to a[i] do
begin
if a[i] mod i = 0 then
j := j+1;
end;
if j = 2 then
songuyento := songuyento +1;
writeln('co ',chan,' so chan, co ', le ,' so le, co ', songuyento , ' so nguyen do trong day.');
end;
readln;
end.