Print 1 to N

print_1toN.cpp
#include <bits/stdc++.h>
using namespace std;

void print_1toN(int n){
    if(n==0)
        return;
    print_1toN(n-1);
    cout << n << " ";
}

int main() {
    int n;
    cin >> n;
    print_1toN(n);
    return 0;
}
Output
5
1 2 3 4 5