View on GitHub

30daysofcode

Try a new challenge every day for 30 days. By the end of the month, you'll go from newbie to expert.

Day 9 - Recursion

Objective

Today, we’re learning and practicing an algorithmic concept called Recursion.

Task

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

Input Format

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

Constraints

Your submission must contain a recursive function named factorial.

Output Format

Print a single integer denoting .

Sample Input

3

Sample Output

6