Middle three digits: Difference between revisions

(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
Line 5,235:
else cnr = substr(string(nr),mnr,3) see cnr + nl ok
</syntaxhighlight>
 
=={{header|RPL}}==
Staying in the real world: no number/string conversion, -1 is returned if input is invalid.
{{works with|Halcyon Calc|4.2.7}}
<syntaxhighlight lang="RPL">
≪ ABS DUP XPON
IF DUP 2 < OVER 2 MOD OR THEN
DROP2 -1
ELSE
2 / 1 - ALOG / IP 1000 MOD
END
'→M3D' STO
 
≪ { 123 12345 1234567 987654321 10001 -10001 -123 -100 100 -12345 -10 2002}
1 OVER SIZE FOR j
DUP j GET →M3D
NEXT
≫ EVAL
</syntaxhighlight>
{{out}}
<pre>
12:123
11:234
10:345
9:654
8:0
7:0
6:123
5:100
4:100
3:234
2:-1
1:-1
</pre>
 
=={{header|Ruby}}==
1,150

edits