Write a program which employs Recursion
Answer / Mohit Singh
Here's a simple recursive function example in C++ that calculates the factorial of a given number:n```nvoid factorial(int n, long long result = 1) {n if (n > 1) {n factorial(n - 1, result *= n);n }n cout << result;n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Which operator cannot overload?
What c++ library is string in?
Define basic type of variable used for a different condition in C++?
What is a hash function c++?
What is the difference between *p++ and (*p)++ ?
Is c# written in c++?
What are the advantages of using friend classes?
What is 'Copy Constructor' and when it is called?
Live example for static function?
What is else syntax in c++?
Do you need a main function in c++?
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).