Advertisement
Dar954826

MCD[ITA].py

Oct 24th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 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("Inserisci il primo numero: ")
  10.   b1=input("Inserisci il secondo numero: ")
  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("Il Massimo Comune Divisore tra", a, "e",b,"e'",x)
  30.   input("Clicca per continuare")
  31.   print('\n'*1000)
  32.  except ValueError :
  33.   input(" Devi inserire un numero non una lettera")
  34.   print('\n'*1000)
  35.  #except ZeroDivisionError :
  36.  # input(" Devi inserire un numero diverso da zero")
  37.   #print('\n'*1000)
  38.  
  39.  
  40.  
  41.  
  42. while oop:
  43.  mcm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement