python_math_stat/practica/math/statistic/Greatest_common_divisor.py

14 lines
213 B
Python
Raw Normal View History

2023-10-04 16:07:27 +03:00
# НОД чисел, алгоритм Евклида
a = int(input())
b = int(input())
while a!=0 and b!=0:
if a > b:
a = a % b
else:
b = b % a
if a != 0:
print(a)
else:
print (b)