11 lines
176 B
Text
11 lines
176 B
Text
def binomialCoeff(n, k)
|
|
result = 1
|
|
for i in range(1, k)
|
|
result = result * (n-i+1) / i
|
|
end
|
|
return result
|
|
end
|
|
|
|
if main
|
|
println binomialCoeff(5,3)
|
|
end
|