Saved Bookmarks
| 1. |
Write a function in a program which returns the factorial of a number._____________________- Coding in C++- Kindly answer it in simplest codingThanks a lot! ♥*spammers stay away* |
|
Answer» Answer: // C++ program to FIND factorial of GIVEN number #include using namespace STD;
// function to find factorial of given number UNSIGNED int factorial(unsigned int n) { if (n == 0) return 1; return n * factorial(n - 1); }
// Driver code int main() { int num = 5; cout << "Factorial of " << num << " is " << factorial(num) << endl; return 0; }
|
|