Ask Question
26 March, 20:32

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

+4
Answers (1)
  1. 26 March, 20:42
    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?
Find an answer to your question ✅ “Write a recursive function using pseudocode or C/C++. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers