Print “Hello World” on a new line ‘n’ times.
Challenge 2:
object Solution { def main(args: Array[String]) { val sc = new java.util.Scanner (System.in); var n = sc.nextInt(); // Print "Hello World" on a new line 'n' times. f(5); } } def f(n: Int) = (1 to n) foreach(x => println("Hello World"))