repeat writeln('Enter the number of digits N (N >= 2): '); readln(N); until N >= 2;
for i := 1 to N do begin minNum := minNum * 10 + 1; end;
repeat X := minNum; prod := 1;
while X > 0 do begin num := X mod 10; prod := prod * num; X := X div 10; end; if (prod * 3 = minNum) then begin writeln('The smallest ', N, '-digit number X, which is equal to three times the product of its digits, is: ', minNum); break; end; minNum := minNum + 1;
program FindNumber;
var
X, N, i, num, prod, minNum: integer;
begin
minNum := 0;
repeat
writeln('Enter the number of digits N (N >= 2): ');
readln(N);
until N >= 2;
for i := 1 to N do
begin
minNum := minNum * 10 + 1;
end;
repeat
while X > 0 doX := minNum;
prod := 1;
begin
num := X mod 10;
prod := prod * num;
X := X div 10;
end;
if (prod * 3 = minNum) then
begin
writeln('The smallest ', N, '-digit number X, which is equal to three times the product of its digits, is: ', minNum);
break;
end;
minNum := minNum + 1;
until false;
end.