Created
May 8, 2021 07:03
-
-
Save CheolhoJeon/c8f2978c46ee0fad66533fd7ea8f93db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chap4.Recursion | |
import atomictest.eq | |
fun factorial(n: Long): Long { | |
if (n <= 1) return 1 | |
return n * factorial(n - 1) | |
} | |
fun main() { | |
factorial(5) eq 120 | |
factorial(17) eq 355687428096000 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment