Anonymous user
Greatest common divisor: Difference between revisions
Added LFE example
(Added an Algol W sample) |
(Added LFE example) |
||
Line 1,523:
{{VI snippet}}<br/>
[[File:LabVIEW Greatest common divisor.png]]
=={{header|LFE}}==
{{trans|Clojure}}
<lang lisp>
> (defun gcd
"Get the greatest common divisor."
((a 0) a)
((a b) (gcd b (rem a b))))
</lang>
Usage:
<pre>
> (gcd 12 8)
4
> (gcd 12 -8)
4
> (gcd 96 27)
3
> (gcd 51 34)
17
</pre>
=={{header|Liberty BASIC}}==
<lang lb>'iterative Euclid algorithm
|