Var n,i,a,p,s,f:integer;
begin
write('n = ');
readln(n);
f:=0;
for i:=1 to n-1 do
begin
p:=1; s:=0;
a:=i;
while a>0 do
begin
p:=p*(a mod 10);
s:=s+(a mod 10);
a:=a div 10;
end;
if p=s then begin write(i,' '); f:=1; end;
end;
if f=0 then writeln('нет');
end.
Пример:
n = 150
1 2 3 4 5 6 7 8 9 22 123 132