# -*- coding:utf-8 -*-

__nom_fichier__ = "utilitaire"
__author__ = "tinet1"
__date__ = "mars 2018"

"""
Exercice récapitulatif

Fractions

Utilitaires : calcul du PGCD

"""

def pgcd_euclide(a, b):
    """
    :param a: DESCRIPTION
    :type a: TYPE
    :param b: DESCRIPTION
    :type b: TYPE
    :return: DESCRIPTION
    :rtype: TYPE

    """
    a, b = abs(a), abs(b)
    
    while a%b > 0:
        
        a, b = b, a%b 
        
    return b

# Programme principal
if __name__ == "__main__":
    
    tests = [(2,4), (4,2), (29, 59), (7, 49), (9, 12)]
    
    for a, b in tests:
        print(pgcd_euclide(a, b))