Greatest common divisor: Difference between revisions

Content added Content deleted
(adding maxima)
m (→‎{{header|REXX}}: changed the output to use a template. -- ~~~~)
Line 1,861: Line 1,861:
say 'the GCD of 496 and 8128 is' gcd(496,8128)
say 'the GCD of 496 and 8128 is' gcd(496,8128)
exit /*──(above)──two perfect numbers.*/
exit /*──(above)──two perfect numbers.*/

/*─────────────────────────────────────GCD subroutine───any num of args.*/
/*─────────────────────────────────────GCD subroutine───any num of args.*/
gcd: procedure; parse arg x,y /*find greatest common divisor. */
gcd: procedure; parse arg x,y /*find greatest common divisor. */
Line 1,874: Line 1,873:


return x</lang>
return x</lang>
'''output'''
Output:
<pre style="height:25ex;overflow:scroll">
<pre style="ex;overflow:scroll">
the GCD of 7 and 21 is 7
the GCD of 7 and 21 is 7
the GCD of 4 and 7 is 1
the GCD of 4 and 7 is 1