Advertisement
Dar954826

mcm[ITA].py

Oct 24th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 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.   if a1=="00":
  11.    main1()
  12.   b1=input("Inserisci il secondo numero: ")
  13.   if b1=="00":
  14.    main1()
  15.   a=int(a1)
  16.   b=int(b1)
  17.   if a==0 or b==0:
  18.    a=6
  19.    b=0
  20.    a/b
  21.   if a>b:
  22.    x=a
  23.   elif a<b:
  24.    x=b
  25.   elif a==b:
  26.    x=a
  27.   for y in range(a*b):
  28.    if x%a==0 and x%b==0:
  29.     break
  30.    else:
  31.     x=x+1
  32.   print('\n'*1000)
  33.   print("Il minimo comune multiplo tra", a,"e",b, "e'", x)
  34.   input("Clicca per continuare")
  35.   print('\n'*1000)
  36.  except ValueError :
  37.   input(" Devi inserire un numero non una lettera")
  38.   print('\n'*1000)
  39.  except ZeroDivisionError :
  40.   input(" Devi inserire un numero diverso da zero")
  41.   print('\n'*1000)
  42.  
  43. while oop :
  44.  mcm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement