progs/factT.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Wed, 06 Mar 2024 18:20:25 +0000
changeset 484 c4561fc667b7
parent 449 d67c5f7177a6
permissions -rw-r--r--
test

object FactT {

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

}