Advertisement
Dar954826

GCD[ENG].py

Oct 24th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. oop=bool("false")
  2. def mcm() :
  3.  global a1
  4.  global a
  5.  global b1
  6.  global b
  7.  global x
  8.  try:
  9.   a1=input("Insert first number: ")
  10.   b1=input("Insert second number: ")
  11.   a=int(a1)
  12.   b=int(b1)
  13.   if a<b:
  14.    x=b
  15.   elif a>b:
  16.    x=a
  17.   elif a==b:
  18.    x=a
  19.   x=x+1
  20.   if a==0 or b==0:
  21.    error1=6/0
  22.   else:
  23.    for poi in range(999999999999999):
  24.     print(a,b,x)
  25.     if a%x==0 and b%x==0:
  26.      break
  27.     else:
  28.      x=x-1
  29.    print("The Greatest Common Divisor among", a, "and",b,"is",x)
  30.   input("Click To Erase")
  31.   print('\n'*1000)
  32.  except ValueError :
  33.   input(" You must insert a number,not a letter")
  34.   print('\n'*1000)
  35.  except ZeroDivisionError :
  36.   input(" You must insert a number different from zero")
  37.   print('\n'*1000)
  38.  
  39.  
  40.  
  41.  
  42. while oop:
  43.  mcm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement