Print Pattern using Recursion

Can you please check following code to print the pattern using recursion: Is this fine ? or the signature of the function should be like the shown in the video ?

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

Hey @kakkarhk Your code is also fine and good.

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.