September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,6 +1,6 @@
|
|||
fun facti(n: Int) = when {
|
||||
n < 0 -> throw IllegalArgumentException("negative numbers not allowed")
|
||||
else -> {
|
||||
else -> {
|
||||
var ans = 1L
|
||||
for (i in 2..n) ans *= i
|
||||
ans
|
||||
|
|
@ -10,7 +10,7 @@ fun facti(n: Int) = when {
|
|||
fun factr(n: Int): Long = when {
|
||||
n < 0 -> throw IllegalArgumentException("negative numbers not allowed")
|
||||
n < 2 -> 1L
|
||||
else -> n * factr(n - 1)
|
||||
else -> n * factr(n - 1)
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue