python 최대공약수(GCD)

최대공약수 greatest common divisor(GCD)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def finding_gcd(a, b):
while(b != 0):
result = b
a, b = b, a % b
return result

def test_finding_gcd():
number1 = 21
number2 = 12
assert(finding_gcd(number1, number2) == 3)
print("테스트 통과!")

if __name__ == "__main__":
test_finding_gcd()
You need to set install_url to use ShareThis. Please set it in _config.yml.

Comments