write a algorithm and draw corresponding flowchart to calculate the factorial of a given number
Answers
Answered by
3
Here's a node.JS program. Do note we use a recursive function and a ternary operator here.
function factorial (number) {
return number === 0 ? 1 : x*factorial(number-1);
}
Check the attachment to see the algorithm:
function factorial (number) {
return number === 0 ? 1 : x*factorial(number-1);
}
Check the attachment to see the algorithm:
Attachments:
Similar questions