91.0k views
1 vote
You wrote a program to find the factorial of a number using recursion. 4! =

1 Answer

3 votes

Answer:

24

Step-by-step explanation:

Anything "factorial" is the result of multiplying the number by itself and all numbers below it, so:

4! = 4 × 3 × 2 × 1 = 24

There's no other info for this question so I assume you just wanted the answer, but as an example of a program here's a function that would work it out for you by using recursion in javascript, to use this you would call factorial(4) like at the bottom:

function factorial(num) {

if (num < 0)

return -1;

else if (num == 0)

return 1;

else {

return (num * factorial(num - 1));

}

}

factorial(4);

User Aleksey Potapov
by
4.5k points