You are viewing a single comment's thread. Return to all comments →
Easiest SCALA code
def main(args: Array[String]) { val digit = io.Source.stdin.getLines.take(1).map(_.trim.toInt).next() def factorial(num: Int) = (1 to num).product (0 until digit).foreach(n =>{ (0 to n).foreach(r => { print(factorial(n)/(factorial(r) * factorial(n-r)) + " ") }) println() } ) }
Pascal's Triangle
You are viewing a single comment's thread. Return to all comments →
Easiest SCALA code