- khai báo
bein
- nhập n, k, dãy số
- dem:=0;
for i:=1 to n do
if a[i] mod k=0 then dem:=dem+1;
writeln(dem);
end.
uses crt;
var a:array[1..100]of integer;
i,n,k,dem:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{-----------------xuat------------------}
for i:=1 to n do
write(a[i]:4);
{---------------xu-ly-------------------}
writeln;
write('nhap k='); readln(k);
dem:=0;
for i:=1 to n do
if a[i] mod k=0 then inc(dem);
writeln('so phan tu chia het cho ',k,' trong day la: ',dem);
readln;
end.