Factors of an integer: Difference between revisions

Content added Content deleted
m (moved Netrexx to proper position)
(→‎{{header|NetRexx}}: add method main to accept argument(s))
Line 1,396: Line 1,396:
<lang NetRexx>/* NetRexx ***********************************************************
<lang NetRexx>/* NetRexx ***********************************************************
* 21.04.2013 Walter Pachl
* 21.04.2013 Walter Pachl
* 21.04.2013 add method main to accept argument(s)
*********************************************************************/
*********************************************************************/
options replace format comments java crossref symbols nobinary
options replace format comments java crossref symbols nobinary
class divl
a=1
method main(argwords=String[]) static
b=64
arg=Rexx(argwords)
loop x=a To b
Parse arg a b
say x.right(2) '->' divs(x)
Say a b
End
If a='' Then Do
help='java divl low [high] shows'
help=help||' divisors of all numbers between low and high'
Say help
Return
End
If b='' Then b=a
loop x=a To b
say x.right(2) '->' divs(x)
End


method divs(x) public static returns Rexx
method divs(x) public static returns Rexx
Line 1,419: Line 1,430:
return lo hi /* return both lists */</lang>
return lo hi /* return both lists */</lang>
Output:
Output:
<pre> 1 -> 1
<pre>java divl 1 10
1 -> 1
2 -> 1 2
2 -> 1 2
3 -> 1 3
3 -> 1 3
Line 1,429: Line 1,441:
9 -> 1 3 9
9 -> 1 3 9
10 -> 1 2 5 10
10 -> 1 2 5 10
etc.</pre>
etc.</pre>


=={{header|Niue}}==
=={{header|Niue}}==