[Solved] Why does return not work?


Return works perfectly, it’s just that your code is not using it.

The call to factorial(num) produces no output, just the return value. If you want to see it printed, add cout << factorial(num) << endl;

6

solved Why does return not work?