Задание 15 параграф 3.1 сделал
This commit is contained in:
parent
8f2ae0953c
commit
6e6ba8d4ea
18
3.1_lesson.15.20.py
Normal file
18
3.1_lesson.15.20.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
***Задание 13 Параграф 3.1***
|
||||||
|
***Напишите программу, которая находит НОД всех чисел, введённых в одной строке через пробел.****
|
||||||
|
|
||||||
|
if name == "main":
|
||||||
|
string = input().split()
|
||||||
|
|
||||||
|
numbers = []
|
||||||
|
|
||||||
|
for digits in string:
|
||||||
|
numbers.append(int(digits))
|
||||||
|
|
||||||
|
current_gcd = numbers[0]
|
||||||
|
|
||||||
|
for number in numbers[1:]:
|
||||||
|
while number != 0:
|
||||||
|
current_gcd, number = number, current_gcd % number
|
||||||
|
|
||||||
|
print(current_gcd)
|
||||||
Loading…
Reference in a new issue