Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added factorial problem and solution #94

Merged
merged 2 commits into from Oct 16, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add factorial problem
  • Loading branch information
iamvalentin23 committed Oct 15, 2019
commit 7a889e20a344204d3744fde8cda89f9005ffc43d
8 changes: 8 additions & 0 deletions src/_Problems_/factorial/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function factorial(num) {
if (num === 1) return num;
else return num * factorial(num - 1);
}

module.exports = {
factorial,
};