Ask Question

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

+3
Answers (1)
  1. 6 January, 04:23
    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 & 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