Ministério da Educação
Brasil um país de todos
Personal tools
You are here: Home Members Cicero Garrozi Disciplinas 2014 em diante Introdução à Programação Arquivos 2016-1 Algoritmos slides12-ex05-mdc.py
Navigation
Log in


Forgot your password?
 
Document Actions

slides12-ex05-mdc.py

by Cicero Garrozi last modified 2014-07-03 07:24

Click here to get the file

Size 1 kB - File type text/python-source

File contents

def mdc(a, b):
    if a % b == 0:
        return b
    else:
        print "Calculando mdc(%d,%d)"%(b, a%b)
        return mdc(b, a%b)

#exemplo: 
##>>> mdc(70, 42)
##14
##>>> mdc(42, 28)
##14
##>>> mdc(28, 14)
##14
##>>> 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: