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

Add FOCAL
(Add MAD)
(Add FOCAL)
Line 178:
</pre>
 
=={{header|FOCAL}}==
<lang focal>01.10 F N=0,999;D 2;D 4
01.20 Q
 
02.10 S A=0
02.20 S B=N
02.30 S C=FITR(B/10)
02.40 S A=A+(B-C*10)
02.50 S B=C
02.60 I (-B)2.3
 
03.10 S B=1
03.20 S B=B*10
03.30 I (B-M)3.2,3.2
03.40 S B=B/10
03.50 S M=M-FITR(M/B)*B
 
04.10 S P=N
04.20 S M=P
04.30 I (M-A)4.4,4.9,4.4
04.40 D 3
04.50 I (M)4.3,4.6,4.3
04.60 S P=FITR(P/10)
04.70 I (P)4.2,4.8,4.2
04.80 R
04.90 T %3,N,!</lang>
{{out}}
<pre style='height:50ex;'>= 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>
=={{header|FreeBASIC}}==
<lang freebasic>function is_substring( s as string, j as string ) as boolean
Line 200 ⟶ 275:
next i : print : end</lang>
{{out}}<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>
 
 
=={{header|Go}}==
2,093

edits