The Artima Developer Community
Sponsored Link

Python Answers Forum
GCD program using Euclid’s algorithm

1 reply on 1 page. Most recent reply: Nov 8, 2010 12:48 AM by captain eddy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
captain eddy

Posts: 4
Nickname: hemsbond
Registered: Oct, 2010

GCD program using Euclid’s algorithm Posted: Oct 26, 2010 8:38 PM
Reply to this message Reply
Advertisement
How do u find gcd using Euclid’s algorithm


captain eddy

Posts: 4
Nickname: hemsbond
Registered: Oct, 2010

Re: GCD program using Euclid’s algorithm Posted: Nov 8, 2010 12:48 AM
Reply to this message Reply

def euclid_gcd(a,b):
while 1>0:
if a>b:
a=a-b
elif b>a:
b=b-a
elif a==b:
print a
break

a=input('Enter 1st num')
b=input('Enter 2nd num')
euclid_gcd(a,b)

Flat View: This topic has 1 reply on 1 page
Topic: To overthrow the password Previous Topic   Next Topic Topic: How to convert python script to the text?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use