Created
February 9, 2023 17:25
-
-
Save Miron-Anosov/55c5a9e58a11ebe84ff1742656632992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Задача 2. «Назад в будущее»') | |
# Вы — один из разработчиков языка программирования Python, и вы пишете специальный математический модуль, который можно было бы просто подключить внутри программы и облегчить жизнь всем программистам. | |
# Реализуйте функцию gcd, которая получает два параметра — два числа — и возвращает наибольший общий делитель этих двух чисел. | |
# Пример работы программы: | |
# Введите первое число: 6 | |
# Введите второе число: 10 | |
# НОД = 2 | |
import math | |
def gcd(): | |
if num_one > num_two: | |
ansver = math.gcd(num_one, num_two) | |
return ansver | |
else: | |
ansver = math.gcd(num_two, num_one) | |
return ansver | |
num_one = int(input('Введите первое число: ')) | |
num_two = int(input('Введите второе число: ')) | |
gcd() | |
print('НОД =', gcd()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def