From 6fd8942cff1089bcc5cf8661b4549df74f266f58 Mon Sep 17 00:00:00 2001 From: Kevin Vaughan Date: Tue, 15 Oct 2019 15:24:40 -0500 Subject: [PATCH] Create factorial.kt --- Mathematical Algorithms/factorial.kt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Mathematical Algorithms/factorial.kt diff --git a/Mathematical Algorithms/factorial.kt b/Mathematical Algorithms/factorial.kt new file mode 100644 index 0000000..ae60b13 --- /dev/null +++ b/Mathematical Algorithms/factorial.kt @@ -0,0 +1,9 @@ +fun factorial() { + val num = 9 + var factorial: Long = 1 + for (i in 1..num) { + factorial *= i.toLong() + } + println("the factorial of $num is $factorial") + +}