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

Add CLU
(Added 11l)
(Add CLU)
Line 479:
{{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|CLU}}==
<lang clu>divisible = proc (n: int) returns (bool)
prod: int := 1
dgts: int := n
while dgts > 0 do
dgt: int := dgts // 10
if dgt=0 cor n//dgt~=0 then
return(false)
end
prod := prod * dgt
dgts := dgts / 10
end
return(n//prod~=0)
end divisible
 
start_up = proc ()
po: stream := stream$primary_output()
col: int := 0
for n: int in int$from_to(1,1000) do
if divisible(n) then
stream$putright(po, int$unparse(n), 5)
col := col + 1
if col//10=0 then stream$putc(po,'\n') end
end
end
end start_up</lang>
{{out}}
<pre> 22 33 44 48 55 66 77 88 99 122
124 126 155 162 168 184 222 244 248 264
2,114

edits