Simple C/C++ Solution


#1

int Solution::gcd(int A, int B) {
if(A==0)
return B;
else if(B==0)
return A;
return gcd(B,A%B);
}

or you can use inbuilt C++ function

int Solution::gcd(int A, int B) {
return __gcd(A,B);
}