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

Content added Content deleted
(Add CLU)
(Add Draco)
Line 662: Line 662:
488 515 555 636 648 666 728 777 784 824
488 515 555 636 648 666 728 777 784 824
848 864 888 936 999</pre>
848 864 888 936 999</pre>

=={{header|Draco}}==
<lang draco>proc nonrec divisible(word n) bool:
word dprod, c, dgt;
bool div;
c := n;
div := true;
dprod := 1;
while div and c /= 0 do
dgt := c % 10;
c := c / 10;
if dgt = 0 or n % dgt /= 0
then div := false
else dprod := dprod * dgt
fi
od;
div and n % dprod /= 0
corp

proc nonrec main() void:
word n, c;
c := 0;
for n from 1 upto 999 do
if divisible(n) then
write(n:5);
c := c+1;
if c % 10 = 0 then writeln() fi
fi
od
corp</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</lang>


=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==
Line 673: Line 712:
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
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>
</pre>

=={{header|Factor}}==
=={{header|Factor}}==
{{works with|Factor|0.99 2021-02-05}}
{{works with|Factor|0.99 2021-02-05}}