Sum of the digits of n is substring of n: Difference between revisions

Content added Content deleted
(Add J)
(Add BASIC)
Line 41: Line 41:
<pre>0 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 109 119 129 139 149 159 169 179 189 199 200 300 400 500 600 700 800 900
<pre>0 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 109 119 129 139 149 159 169 179 189 199 200 300 400 500 600 700 800 900
910 911 912 913 914 915 916 917 918 919</pre>
910 911 912 913 914 915 916 917 918 919</pre>

=={{header|BASIC}}==
<lang basic>10 DEFINT I,J,K
20 FOR I=0 TO 999
30 J=0: K=I
40 IF K>0 THEN J=J+I MOD 10: K=K\10: GOTO 40
50 IF INSTR(STR$(I),STR$(J)) THEN PRINT I,
60 NEXT I</lang>
{{out}}
<pre> 0 1 2 3 4
5 6 7 8 9
21 42 63 84 124
155 186 217 248 279
301 311 321 331 341
351 361 371 381 391
602 612 622 632 642
652 662 672 682 692
903 913 923 933 943
953 963 973 983 993</pre>


=={{header|Factor}}==
=={{header|Factor}}==