Recursive Problem Help

Hello guys, I just need some help with the code below.
I just need to fix it by successfully printing the expected output below.
My output:
123456789101112

Expected Output:
121110987654321

#include <iostream>

using namespace std;
void recursive (int n) 
{
    if (n == 0)
    return;
    recursive (n-1);
    cout <<  n;
}

int main()
{
recursive(12);

    return 0;
}
Last edited on
Your output is the expected output. What is the problem?
My output result is 123456789101112 and my output should print the numbers reversely. It should be 121110987654321. I just got a typo. My apologies for that. I just updated my concern above.
Last edited on
Print your number cout << n; BEFORE you recurse to the next lower recursive (n-1);
Thanks. I appreciate that.
Last edited on
Topic archived. No new replies allowed.