Next highest int from digits: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added REXX stub.) |
(→{{header|REXX}}: added the REXX computer programming language for this task.) |
||
Line 278: | Line 278: | ||
return 0</lang> |
return 0</lang> |
||
=={{header |
=={{header|REXX}}== |
||
<lang rexx>/*REXX program finds the next highest |
<lang rexx>/*REXX program finds the next highest positive integer from a list of decimal digits. */ |
||
parse arg n /*obtain optional arguments from the CL*/ |
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? */ |
if n='' | n="," then n= 0 9 12 21 12453 738440 45072010 95322020 /*use the defaults? */ |
||
Line 304: | Line 304: | ||
do m=0 for 10; if @.m==0 then iterate; $= $ || copies(m, @.m) |
do m=0 for 10; if @.m==0 then iterate; $= $ || copies(m, @.m) |
||
end /*m*/; return $ /* [↑] build a sorted digit mask.*/</lang> |
end /*m*/; return $ /* [↑] build a sorted digit mask.*/</lang> |
||
{{out|output|text= when using the default inputs:}} |
|||
<pre> |
|||
for 0, the next highest integer is: 0 |
|||
for 9, the next highest integer is: 0 |
|||
for 12, the next highest integer is: 21 |
|||
for 21, the next highest integer is: 0 |
|||
for 12453, the next highest integer is: 12534 |
|||
for 738440, the next highest integer is: 740348 |
|||
for 45072010, the next highest integer is: 45072100 |
|||
for 95322020, the next highest integer is: 95322200 |
|||
</pre> |