uses crt;
var n,i,dem:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
until n>0;
dem:=0;
for i:=1 to n do
if i mod 3=0 then
begin
write(i:4);
dem:=dem+1;
end;
writeln;
writeln('Trong pham vi tu 1 toi ',n,' co ',dem,' so chia het cho 3');
readln;
end.