progs/factT.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 06 Jun 2024 22:18:15 +0100
changeset 490 4778fefecd0c
parent 449 d67c5f7177a6
permissions -rw-r--r--
updated

object FactT {

def factT(n: Int, acc: Int): Int =
  if (n == 0) acc else factT(n - 1, n * acc)

}