To find out the GCD/GCF of two integers, you can make use of euclidean algorithm. That is, GCD(a, = GCD(a%b, if a>b. You can use a recursive function to find out the answer in fewer steps. The function should look like this int GCD(int a , int { if (a == { return a; } if (a * b == 0) { return a + b; } return ( a%b , b%a); } Hope it can help.
To find out the GCD/GCF of two integers, you can make use of euclidean algorithm. That is, GCD(a,b ) = GCD(a%b,b ) if a>b. You can use a recursive function to find out the answer in fewer steps. The function should look like this int GCD(int a , int b){ if (a == b) { return a; } if (a * b == 0) { return a + b; } return ( a%b , b%a);}
Hope it can help.