What is the output of this recursive C++ function?
#include <iostream>
using namespace std;
int fun(int n)
{
if (n == 1)
return 1;
return n * fun(n - 1);
}
int main()
{
cout << fun(5);
return 0;
}
Options
- A. 15
- B. 25
- C. 120
- D. More than one of the above
- E. None of the above