Positive decimal integers with the digit 1 occurring exactly twice: Difference between revisions

Content added Content deleted
(add FreeBASIC)
Line 143: Line 143:
11 101 110 211 121 112 311 131 113 411 141 114 511 151 115 611 161 116 711 171 117 811 181 118 911 191 119
11 101 110 211 121 112 311 131 113 411 141 114 511 151 115 611 161 116 711 171 117 811 181 118 911 191 119
</pre>
</pre>

=={{header|FreeBASIC}}==
<lang freebasic>function numdig(byval n as integer, d as const integer) as uinteger
'counts the number of occurrences of digit d in the number n
dim as uinteger m = 0
while n
if n mod 10 = d then m+=1
n\=10
wend
return m
end function

for i as uinteger = 1 to 999
if numdig(i, 1) = 2 then print i;" ";
next i
print</lang>
{{out}}<pre>11 101 110 112 113 114 115 116 117 118 119 121 131 141 151 161 171 181 191 211 311 411 511 611 711 811 911</pre>


=={{header|Go}}==
=={{header|Go}}==