Recursion

19.1 - Recursion basic 1


Your task is to create the function called factorial which accepts an integer and returns the factorial of it.

Sample input code

<?prettify lang=cpp?>

#include <iostream>

int main()
{
    std::cout << factorial(5) << std::endl;
}

Sample output

120
int factorial(int n) { }