Программа на паскале: var a,m,k:integer; begin write('a = '); readln(a); write('m = '); readln(m); k:=0; if a div 1000 = m then k:=k+1; if a div 100 mod 10 = m then k:=k+1; if a mod 100 div 10 = m then k:=k+1; if a mod 10 = m then k:=k+1; writeln('k = ',k); end.
var a,m,k:integer;
begin
write('a = ');
readln(a);
write('m = ');
readln(m);
k:=0;
if a div 1000 = m then k:=k+1;
if a div 100 mod 10 = m then k:=k+1;
if a mod 100 div 10 = m then k:=k+1;
if a mod 10 = m then k:=k+1;
writeln('k = ',k);
end.
Пример:
a = 7537
m = 7
k = 2