Numbers divisible by their individual digits, but not by the product of their digits.: Difference between revisions
Content added Content deleted
Catskill549 (talk | contribs) (added AWK) |
Not a robot (talk | contribs) (Add BCPL) |
||
Line 260: | Line 260: | ||
666 728 777 784 824 |
666 728 777 784 824 |
||
848 864 888 936 999</pre> |
848 864 888 936 999</pre> |
||
=={{header|BCPL}}== |
|||
<lang bcpl>get "libhdr" |
|||
let divisible(n) = valof |
|||
$( let p = 1 |
|||
let c = n |
|||
until c = 0 do |
|||
$( let d = c rem 10 |
|||
if d=0 resultis false |
|||
unless n rem d=0 resultis false |
|||
p := p * d |
|||
c := c / 10 |
|||
$) |
|||
resultis n rem p ~= 0 |
|||
$) |
|||
let start() be |
|||
$( let c = 0 |
|||
for n = 1 to 1000 do |
|||
if divisible(n) do |
|||
$( writef("%I5",n) |
|||
c := c + 1 |
|||
if c rem 10=0 then wrch('*N') |
|||
$) |
|||
wrch('*N') |
|||
$)</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|C}}== |
=={{header|C}}== |