[ create a new paste ] login | about

Link: http://codepad.org/FUrv1UT7    [ raw code | output | fork ]

kabhwan - Ruby, pasted on Apr 7:
1
2
3
4
5
6
7
8
9
10
11
# C/C++로 배우는 자료구조론 연습문제 4.19

def gcd(num1, num2)
  return -1 if num1 < num2

  return num1 if num2 == 0  

  return gcd(num2, num1 % num2)
end

puts gcd(1440, 408)


Output:
1
24


Create a new paste based on this one


Comments: