program ProductOfDigits; var number, digit, product: integer; begin write('Enter a three-digit number: '); readln(number); if (number < 100) or (number > 999) then begin writeln('Invalid input. Please enter a three-digit number.'); readln; exit; end; product := 1; digit := number mod 10; // Get the ones digit product := product * digit; digit := (number div 10) mod 10; // Get the tens digit product := product * digit; digit := number div 100; // Get the hundreds digit product := product * digit; writeln('The product of the digits of the number ', number, ' is ', product); readln; end.
var
number, digit, product: integer;
begin
write('Enter a three-digit number: ');
readln(number);
if (number < 100) or (number > 999) then
begin
writeln('Invalid input. Please enter a three-digit number.');
readln;
exit;
end;
product := 1;
digit := number mod 10; // Get the ones digit
product := product * digit;
digit := (number div 10) mod 10; // Get the tens digit
product := product * digit;
digit := number div 100; // Get the hundreds digit
product := product * digit;
writeln('The product of the digits of the number ', number, ' is ', product);
readln;
end.