Numbers divisible by their individual digits, but not by the product of their digits.: Difference between revisions

Added Algol 68
(Added Algol 68)
Line 152:
184 222 244 248 264 288 324 333 336 366 396 412 424 444 448
488 515 555 636 648 666 728 777 784 824 848 864 888 936 999</pre>
 
=={{header|ALGOL 68}}==
<lang algol68>BEGIN # find numbers divisible by their digits but not the product of their digits #
INT max number = 999;
INT number count := 0;
FOR n TO max number DO
INT digit product := 1;
INT v := n;
BOOL divisible by digits := n /= 0;
WHILE v > 0 AND divisible by digits DO
INT digit = v MOD 10;
divisible by digits := IF digit = 0
THEN FALSE
ELSE n MOD digit = 0
FI;
digit product *:= digit;
v OVERAB 10
OD;
IF divisible by digits THEN
IF n MOD digit product /= 0 THEN
# have a number divisible by its digits but not the product of the digits #
print( ( " ", whole( n, -3 ) ) );
IF ( number count +:= 1 ) MOD 15 = 0 THEN print( ( newline ) ) FI
FI
FI
OD
END</lang>
{{out}}
<pre>
22 33 44 48 55 66 77 88 99 122 124 126 155 162 168
184 222 244 248 264 288 324 333 336 366 396 412 424 444 448
488 515 555 636 648 666 728 777 784 824 848 864 888 936 999
</pre>
 
=={{header|ALGOL-M}}==
3,043

edits