What about this approach? This is easier i guess

public static void pattern(int n){

    if(n==0) return;
    
    pattern(n-1);
    
    for(int i=0; i<n; i++){
        System.out.print("*  ");
    }
    System.out.println();
    
}

hey @rishabhs70427_ac9bc1ed91d2a939 You can use either of the approach.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.