**Objective**

Today, we’re learning and practicing an algorithmic concept called *Recursion*. Check out the Tutorial tab for learning materials and an instructional video!

**Recursive Method for Calculating Factorial**

**Task**

Write a *factorial* function that takes a positive integer, as a parameter and prints the result of ( factorial).

**Input Format**

A single integer, (the argument to pass to *factorial*).

**Output Format**

Print a single integer denoting *N!*.

**Sample Input**

```
3
```

**Sample Output**

`6`

**Explanation: **

- factorial(3) = 3 x factorial(2)
- factorial(2) = 2 x factorial(1)
- factorial(1) = 1

**My solution:**

Recursion is basically defining a base case and applying that base case to the function again to find results for other cases.

This example was easy because the explanation basically tells you how to code it, but once again, I struggled with reading and printing input in Hacker Rank..

Don’t forget to explicitly tell the code to print out the result of the function at the end!