Greatest common divisor: Difference between revisions
Content added Content deleted
(add JavaScript) |
|||
Line 878: | Line 878: | ||
=={{header|Scheme}}== |
=={{header|Scheme}}== |
||
<lang scheme>(define (gcd a b) |
<lang scheme>(define (gcd a b) |
||
( |
(if (= b 0) |
||
a |
|||
(gcd b (modulo a b))))</lang> |
|||
(else (gcd a (modulo b a)))))</lang> |
|||
or using the standard function included with Scheme (takes any number of arguments): |
or using the standard function included with Scheme (takes any number of arguments): |