Greatest common divisor: Difference between revisions
Content deleted Content added
m Added to recursion category |
added ocaml |
||
Line 212: | Line 212: | ||
return gcd(a, b % a); |
return gcd(a, b % a); |
||
} |
} |
||
=={{header|OCaml}}== |
|||
let rec gcd a b = |
|||
if a = 0 then b |
|||
else if b = 0 then a |
|||
else if a > b then gcd b (a mod b) |
|||
else gcd a (b mod a) |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |