Find the largest positive integer that divides two given numbers without a remainder. For example, the GCD of 8 and 12 is 4.
clojure (defn gcd [a b]
(if (zero? b)
a
(recur b (mod b a))))
(defn gcd [a b]
(if (zero? b)
a
(recur b (mod b a))))
Submit a new solution for
clojure
There are 16 other solutions in
additional languages (
cpp,
csharp,
erlang,
fantom ...)