Skip to content

Commit

Permalink
Issue trekhleb#1008 factorial of negative number is negative
Browse files Browse the repository at this point in the history
  • Loading branch information
VRJVOID committed Jan 15, 2024
1 parent 76617fa commit 85abf34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/algorithms/math/factorial/factorialRecursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* @return {number}
*/
export default function factorialRecursive(number) {
return number > 1 ? number * factorialRecursive(number - 1) : 1;
return number > 1 ? number * factorialRecursive(number - 1) : -1;
}

0 comments on commit 85abf34

Please sign in to comment.