The hardest part of this homework is, to understand and fidn what the euclid´s algorithm. Once you understand that, everything is much easier.
Be sure to check my code: https://github.com/MiguelAngelCardenas/WSQ11
TO FIND THIS ALGORITHM VISIT THIS SITE: https://en.wikipedia.org/wiki/Euclidean_algorithm