How I can pass this function of iterative to recursive
void triangulo(int max)
{
int i, j;
for(i = 1; i <= max; i++)
{
for(j = 0; j < i; j++)
printf("%d", j + 1);
printf("\n");
}
}
Anyone has any idea? or it is impossible to do this?
update
void triangulo(int n, int i, int j)
{
if(i <= n)
{
if(j < i)
{
printf("%d", j + 1);
triangulo(n, i, j + 1);
}
if (j == i)
{
printf("\n");
triangulo(n, i + 1, 0);
}
}
}