Quiz #6

Hello everyone! Now we have a new quiz, and we’re supposed to create a program that calculates the greatest common divisor of two integers… pretty easy hahaha

We’re going to ask the user to give those values (obviously integers because… I don’t know, integers rules!) and the program will calculate the greatest common divisor using the Euclid’s algorithm. Now what the… is the Euclid’s algorithm?? Here you can see what it is…

Captura de pantalla 2016-04-04 a las 7.59.51 p.m.

Now let’s create the program. The function called MasterAguayo is where the magic happens. It takes two values and by using ‘if statements’ we are switching the numbers using modules and all that stuff. 

Captura de pantalla 2016-04-04 a las 8.08.34 p.m.

It is pretty easy to understand this algorithm and you’re supposed to know how it works if you’re at college… if that’s not the case, well don’t worry because there is a lot of information available on the web. 

Here is my code via GitHub. You can check it out and feel free to do whatever you want with it. 

Alex H.

24294566811_7004231734_k
Another Sunrise over the Alps by Rogg4n Link on Flickr: https://www.flickr.com/photos/128294308@N05/24294566811/in/explore-2016-01-14/

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