greatest common divisor algorithm code example
Example 1: greatest common divisor
int gcd (int a, int b) {
int temp;
while (a!=0) {
temp = a;
a = b%a;
b = temp;
}
return b;
}
Example 2: gcd algorithm
function gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)