Anonymous user
Positive decimal integers with the digit 1 occurring exactly twice: Difference between revisions
Positive decimal integers with the digit 1 occurring exactly twice (view source)
Revision as of 18:21, 30 November 2021
, 2 years agoAdded solution for Action!
m (→{{header|Pascal}}: added pascal creation by sustituting one One) |
(Added solution for Action!) |
||
Line 4:
Find positive decimal integers '''n''' in which the digit '''1''' occurs exactly twice, where '''n < 1,000'''.
<br><br>
=={{header|Action!}}==
<lang Action!>BYTE FUNC OnesCount(INT x)
BYTE c,d
c=0
WHILE x#0
DO
d=x MOD 10
IF d=1 THEN
c==+1
FI
x==/10
OD
RETURN (c)
PROC Main()
INT i
FOR i=0 TO 999
DO
IF OnesCount(i)=2 THEN
PrintI(i) Put(32)
FI
OD
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Positive_decimal_integers_with_the_digit_1_occurring_exactly_twice.png Screenshot from Atari 8-bit computer]
<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|ALGOL 68}}==
|