Greatest common divisor: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 453: | Line 453: | ||
return gcd(a, b-a); |
return gcd(a, b-a); |
||
}</lang> |
}</lang> |
||
===Recursive=== |
|||
<land d> |
|||
long gcd(long x, long y) { |
|||
if (y == 0) |
|||
return x; |
|||
return gcd(y, x%y); |
|||
} |
|||
</lang> |
|||
=={{header|Dc}}== |
=={{header|Dc}}== |