Hackerrank – Hello World N Times
Problem Statement A description of the problem can be found on Hackerrank. Solution
1 2 3 4 5 6 7 8 |
object HelloWorldNTimes extends App { def f2(i: Int): Unit = println("Hello World") def f(n: Int) = (1 to n).foreach(f2(_)) var n = readInt f(n) } |
Solution also available on my GitHub.