8000 Add files via upload by Saurav-IIITU · Pull Request #24 · AllAlgorithms/matlab · GitHub
[go: up one dir, main page]

Skip to content

Add files via upload #24

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
Create factorial_recursive.m
Function to calculate factorial with recursive method
  • Loading branch information
Saurav-IIITU authored Oct 21, 2023
commit e4dc58303dda4ea89075dbf41dc2f56668058e54
7 changes: 7 additions & 0 deletions algorithms/math/factorial_recursive.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function result = factorial_recursive(n)
if n == 0 || n == 1
result = 1;
else
result = n * factorial_recursive(n - 1);
end
end
0