I am currently having hard time to understand this code because I'm not pro in recursion. So, I wanna someone to explain the logic behind this.
#include <iostream>
using namespace std;
void fun(int n){
    if(n==0){
        return;
    }
    for (int i = 0; i < 5; i++) {
        cout<<n<<" ";
        fun(n-1);
    }
}
int main()
{
    fun(5);
    return 0;
}
Output- https://ideone.com/ZvLGih
I understood the output up to 5 4 3 2 1 then when the base condition hits then after I'm not able to understand the logic.
 
     
    