Factors of an integer: Difference between revisions
→{{header|NetRexx}}: add method main to accept argument(s)
Walterpachl (talk | contribs) m (moved Netrexx to proper position) |
Walterpachl (talk | contribs) (→{{header|NetRexx}}: add method main to accept argument(s)) |
||
Line 1,396:
<lang NetRexx>/* NetRexx ***********************************************************
* 21.04.2013 Walter Pachl
* 21.04.2013 add method main to accept argument(s)
*********************************************************************/
options replace format comments java crossref symbols nobinary
class divl
method main(argwords=String[]) static
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
Line 1,419 ⟶ 1,430:
return lo hi /* return both lists */</lang>
Output:
<pre>java divl 1
1 -> 1
2 -> 1 2
3 -> 1 3
Line 1,429 ⟶ 1,441:
9 -> 1 3 9
10 -> 1 2 5 10
etc.</pre>
=={{header|Niue}}==
|