# Hello World N Times – HackerRank Solution

In this post, we will solve Hello World N Times HackerRank Solution. This problem (Hello World N Times) is a part of HackerRank Functional Programming series.

Contents

Print “Hello World”Â NÂ amount of times. The input portion will be handled automatically. You need to write a function with the recommended method signature.

## Input Format

A single line of input containing integerÂ N, the number of times to print “Hello World”.

## Output Format

OutputÂ NÂ lines, each containing “Hello World”.

## Constraints

• 0 <= N <= 50

Sample Input

``4``

Sample Output

``````Hello World
Hello World
Hello World
Hello World``````

Recommended Method Signature

``````Number Of Parameters: 1
Parameters: [n]
Returns: nil``````

For Hackers Using Clojure

This will be the outline of your function body (fill up the blank portion marked by underscores):

`` (fn[n]___________________________)``

For Hackers Using Scala

This will be the outline of your function body (fill up the blank portion marked by underscores):

`` def f(n: Int) = ______________________``

`` hello_worlds n = ______________________``

This will be the outline of your function body (fill up the blank portion marked by underscores):

For Hackers Using other Languages

You have to read input from standard input and write output to standard output. Please follow the input/output format mentioned above.

NOTE: You only need to submit the code above, after filling in the blanks appropriately. The input and output section will be handled by us. The focus is on writing the correct function.

## Solution – Hello World N Times – HackerRank Solution

Scala

```object Solution extends App {
def f(n: Int): Unit = {
(0 until n).foreach(_ => println("Hello World"))
}