Print 1 to N without using a loop3 months ago

In the below program we use recursion to call the function print1ToN to print from 1 to N. You can observe that we have NOT used a loop (for or while loop) in the code.

#include <stdio.h>
#include <stdlib.h>

void print1ToN(int value){
    if(value > 1){
        print1ToN(value-1);
    }
    
    printf("%d ",value);        
}

int main()
{
    int N;
    scanf("%d",&N);
    print1ToN(N);
}