Вот
var
x, d, count:integer;
begin
write('x=');
readln(x);
write('d=');
readln(d);
while x>0 do
if x mod 10 = d then
count:=count+1;
x:= x div 10;
end;
writeln(count);
end.
Вот
var
x, d, count:integer;
begin
write('x=');
readln(x);
write('d=');
readln(d);
while x>0 do
begin
if x mod 10 = d then
count:=count+1;
x:= x div 10;
end;
writeln(count);
end.