Advertisement
Matvey_Borisov

Untitled

Oct 22nd, 2020 (edited)
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. a = int(input())
  2. b = int(input())
  3. k=0
  4.  
  5. print("number for dividing:")
  6. n=int(input())
  7.  
  8. nok=a*b
  9. while a != b:
  10.     if a > b:
  11.         a = a - b
  12.     else:
  13.         b = b - a
  14.  
  15. resh=[1]*(n+1)
  16. resh[0]=0
  17. resh[1]=0
  18. for i in range(n) :
  19.     if resh[i]==1:
  20.         k=i*i
  21.         while (k<=n):
  22.             resh[k]=0
  23.             k=k+i
  24.  
  25. print("NOD:",a)
  26. print("NOK:",nok/a)
  27. for i in range(n+1):
  28.     if resh[i]==1:
  29.         if n%i==0: print(i)
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement