Number Theory/GCD.cpp
// Method - 1
// Max number that is divisible both a and b
1
Max number that is divisible both a and b
1 Max number that is divisible both a and b
int gcd(int a, int b)
{
    int ans = 1;
    for (int i = 1; i <= min(a, b); i++){
        if (a % i == 0 && b % i == 0){
            ans = i;
        }
    }
    return ans;
}
int gcd ( int a , int b ) { int ans = 1 ; for ( int i = 1 ; i <= min ( a , b ) ; i ++ ) { if ( a % i == 0 && b % i == 0 ) { ans = i ; } } return ans ; }
Method - 1
Max number that is divisible both a and b
Method - 1 Max number that is divisible both a and b