Ask Question
16 February, 03:27

Write a c + + program to solve the factorial problem x! by creating a function that calls itself'

+5
Answers (1)
  1. 16 February, 05:49
    0
    Int factorial (int n)

    {

    if (n < = 1) {

    return 1;

    }

    else {

    return n * factorial (n - 1);

    }

    }

    With recursive functions, always check that there is a certain end criterium. When n<=1, the recursion stops.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a c + + program to solve the factorial problem x! by creating a function that calls itself' ...” 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