You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

euklid.py 316B

123456789101112131415
  1. def euklid_ggt(x, y):
  2. while x > 0:
  3. if x < y:
  4. (x, y) = (y, x)
  5. x -= y
  6. return y
  7. if __name__ == "__main__":
  8. print(euklid_ggt(12, 8))
  9. print(euklid_ggt(8, 12))
  10. print(euklid_ggt(12, 12))
  11. print(euklid_ggt(12, 1))
  12. print(euklid_ggt(1, 12))
  13. print(euklid_ggt(1, 1))