Home > Web Front-end > JS Tutorial > body text

Day Functions Solution

PHPz
Release: 2024-08-06 00:09:02
Original
1134 people have browsed it

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
Copy after login

Output

24
Copy after login

Explanation

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

Solution

Functions

Connect

LinkedIn | GitHub

The above is the detailed content of Day Functions Solution. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template