03 & 04 exercises (#96)

This commit is contained in:
NikitaLipatov
2018-12-28 19:25:01 +03:00
committed by Aditya Bhargava
parent 2bf2ab5062
commit 8a0a191975
8 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
private fun fact(x: Int): Int = when (x) {
1 -> 1
else -> x * fact(x - 1)
}
fun main(args: Array<String>) = println(fact(5))