Harshad or Niven series: Difference between revisions
Content added Content deleted
Basicgames (talk | contribs) |
|||
Line 1,410: | Line 1,410: | ||
<pre>1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42 |
<pre>1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42 |
||
1002</pre> |
1002</pre> |
||
=={{header|Craft Basic}}== |
|||
<syntaxhighlight lang="basic">for i = 1 to 1002 |
|||
let t = i |
|||
let s = 0 |
|||
do |
|||
let s = s + t % 10 |
|||
let t = int(t / 10) |
|||
wait |
|||
loop t > 0 |
|||
if i % s = 0 and (c < 20 or i > 1000) then |
|||
let c = c + 1 |
|||
print c, " : ", i |
|||
endif |
|||
next i |
|||
end</syntaxhighlight> |
|||
=={{header|Crystal}}== |
=={{header|Crystal}}== |