Solved GCD using comparison and modulus