Ask Question
14 January, 21:26

Write a recursive function using pseudocode or C/C++.

+4
Answers (1)
  1. 14 January, 22:37
    0
    long fact (int n)

    {

    if (n<=1) / /base case

    return 1;

    long p=fact (n-1); //recursive call.

    return n*p; //returning the factorial.

    }

    Explanation:

    Above written function is written in C+ + language. It is a recursive function to find the factorial of the function.

    If we enter a number equal to or less than 1 then the function returns 1. Then the recursive call is made and it is stored in the long variable p and the result is returned as n*p.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a recursive function using pseudocode or C/C++. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers