Anonymous user
Next highest int from digits: Difference between revisions
m
→{{header|REXX}}: added commas to the numbers in the output.
(→{{header|REXX}}: added the REXX computer programming language for this task.) |
m (→{{header|REXX}}: added commas to the numbers in the output.) |
||
Line 282:
parse arg n /*obtain optional arguments from the CL*/
if n='' | n="," then n= 0 9 12 21 12453 738440 45072010 95322020 /*use the defaults? */
w= length( commas(word(n, words(n) ) )
do j=1 for words(n); y= word(n, j) /*process each of the supplied numbers.*/
Line 295:
if #>lim then #= 0 /*if # > lim, then there is no valid #*/
say 'for '
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg _; do c=length(_)-3 to 1 by -3; _=insert(',', _, c); end; return _
/*──────────────────────────────────────────────────────────────────────────────────────*/
mask: parse arg z, $; @.= 0 /* [↓] build an unsorted digit mask. */
Line 306 ⟶ 308:
{{out|output|text= when using the default inputs:}}
<pre>
for 0
for 9
for 12
for 21
for
for
for
for
</pre>
|