"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Day Functions Solution

Day Functions Solution

Published on 2024-08-05
Browse:180

Day Functions Solution

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

Release Statement This article is reproduced at: https://dev.to/hafijul233/day-1-functionssolution-44po?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3