Euclidean Algorithm
Euclidean Algorithm
Euclidean Algorithm is used to calculate the gcd of two numbers x, y
Example
int gcd(int x, int y) {
while(y !=0)
t = y
y = x % y
x = t
return x
}
Euclidean Algorithm is used to calculate the gcd of two numbers x, y
Example
int gcd(int x, int y) {
while(y !=0)
t = y
y = x % y
x = t
return x
}