project_python/2.3_lesson.6.20.py
2025-12-15 13:52:12 +05:00

20 lines
842 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

****Задание 6 Параграф 2.3***
**** Вы молодец — уже далеко продвинулись в списке задач. За вами начинают признавать мастерство и точность.
Недавно к вам обратились из местного НИИ: им часто нужно находить наибольший общий делитель (НОД) нескольких чисел.
Они знают, что вы с этим справитесь!****
if name == "main":
count = int(input())
gcd = int(input())
for _ in range(count - 1):
number = int(input())
while number != 0 and gcd != 0:
if number >= gcd:
number %= gcd
else:
gcd %= number
gcd = gcd + number
print(gcd)