I have to perform a recursive procedure that prints this:
'\ n' -----one ----two ---3 --4 -5
and for now I have this code that prints the numbers but not the "-".
#include <stdio.h> // sprintf, scanf, ungetc, stdin
void recurrencia(int n) {
if (n > 0) {
recurrencia(n -1);
printf("%d\n", n);
} else printf("\n");
}
int main()
{
recurrencia(5);
return 0;
}
The problem is that I can not add a new parameter to the procedure nor can I use the variable n as a counter.
So my question is: How to register each time I enter the same procedure recursively so I can add the amount of "-" corresponding to the "depth" with which I entered recursively?