Gurus,
I want to know how to write a recursive function that prints
1 12 123 1234 ... ...... For eg: display(4) should print
EDIT: OK, I improved my answer with the guidelines of @lc.
void print_recursive(unsigned int num) { if (num > 1) { print_recursive(num - 1); } for (unsigned int i = 0; i < num; i++) { printf("%d ", (i + 1)); } printf("\n"); }