Day 1: Functions Solution



This content originally appeared on DEV Community and was authored by Mohammad Hafijul Islam

Task

Implement a factorial function with one parameter: an integer, n. It must return the value of n! (i.e., n factorial).

Constraints

  • 1 ≤ n ≤ 10

Input Format

Locked stub code in the editor reads a single integer, n, from stdin and passes it to a factorial function.

Output Format

The function must return the value of n!.

Sample

Input

4

Output

24

Explanation

We return the value of 4! = 4x3x2x1 = 24.

Solution

Functions

Connect

LinkedIn | GitHub


This content originally appeared on DEV Community and was authored by Mohammad Hafijul Islam