WSQ12. Greatest Common Divisor

For this wsq I had to make a program that asks the user for two positive integer numbers and returns the greatest common divisor between those two numbers.

First of all, I defined a function with wich, using Euclid’s algorithm I could accomplish the objective of the task, I just created a recursive function using some if’s and elses according to the criteria.

Outside the function, in the actual coding, I created some loops to verify that the input users were the intended inputs, avoiding errors of data-type.Also, I created an extra loop containing the whole code to keep asking for more values until the user decides to stop.

Here is my code: https://github.com/Manuelmv94/TC1014/blob/master/wsq12.py

CC BY 4.0 WSQ12. Greatest Common Divisor by Manuel Madrigal is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.