python programme to calculate greatest common divisior (GCD) using recursion

def gcdIter(a, b):

”’

a, b: positive integers

returns: a positive integer, the greatest common divisor of a & b.

”’

# Your code here

Recursive Method

 if a == b:

 return a

  elif a > b:

 return gcdIter(a-b, b)

elif b > a:

return gcdIter(a, b-a)

Advertisements

Author: rajukv

Hadoop(BigData) Architect and Hadoop Security Architect can design and build hadoop system to meet various data science projects.

2 thoughts on “python programme to calculate greatest common divisior (GCD) using recursion”

  1. Howdy outstanding website! Does running a blog like
    this require a great deal of work? I have virtually no expertise in computer programming however I had been hoping to start my own blog soon.
    Anyhow, if you have any recommendations or techniques for new blog
    owners please share. I understand this is off subject
    nevertheless I just wanted to ask. Thank you!

    1. Hi Roxana
      Thanks for your comments. Even I don’t know any thing about blogging when started. Start creating account in your favourite blogging sites like word press and slowly you will gain the experience. It’s already 1 year since you posted this, I hope you already started a blog.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s