Quiz 6

170px-Euclidean_algorithm_1071_462This quiz was about using the Euclidean algorithm to  obtain the greatest common divisor. I hope this gif can help you to understand about it.

Subtraction-based animation of the Euclidean algorithm. The initial rectangle has dimensions a = 1071 andb = 462. Squares of size 462×462 are placed within it leaving a 462×147 rectangle. This rectangle is tiled with 147×147 squares until a 21×147 rectangle is left, which in turn is tiled with 21×21 squares, leaving no uncovered area. The smallest square size, 21, is the GCD of 1071 and 462 (Wikipedia).

Also this was a very useful page: khanacademy.

You can find my code for this quiz here: GDC (Euclidean). As you can see I was missing some symbols and declarations at firsts and that’s why it was not working.

quiz6

 

CC BY-SA 4.0 Quiz 6 by martikaglez is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.