Ask Question
30 August, 19:38

In the following pseudocode which uses recursion to find the factorial of a number, which is the base case? Module main () Declare Integer number Declare Integer numFactor Display "Enter a non-negative integer:" Input number Set numFactor = factor (number) Display "The factorial of ", number, " is ", numFactor End Module Function Integer factor (Integer n) If n = = 0 Then Return 1 Else Return n * factor (n - 1) End If End Function

+2
Answers (1)
  1. 30 August, 20:04
    0
    If n = = 0 Then Return 1

    Explanation:

    The recursive function have 3 things which are as following:-

    Base case. Recursive call. Some calculation.

    Base case is defined for the lowest or maximum value possible for the function to reach. Without the base case the recursive function will go in infinite loop means the function will keep calling itself and there will be no stopping that. So the base case prevent this from happening.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In the following pseudocode which uses recursion to find the factorial of a number, which is the base case? Module main () Declare Integer ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers