Pattern number and stars-1

Code given in editorial if compiled getting error

Hey, @pranavbrindavanam_cfc3071355b2f444 You are getting the error bcoz in the editorial only
pattern function code is given you need to complete that code by making the main method and taking inputs in the main method, and then calling that function. Full code is given below :

import java.util.*;
public class Main {
	//creating main method
    public static void main(String args[]) {
		Scanner scn= new Scanner(System.in);
		int n= scn.nextInt();

		//Calling the function pattern3
		pattern3(n);

    }
	public static void pattern3(int N) {

        int nst1 = N;
        int nst2 = -1;
        int rows = 1;

        while (rows <= N) {

            int val = 1;
            int cst = 1;
            while (cst <= nst1) {
                System.out.print(val++ + " ");
                cst++;
            }

            cst = 1;
            while (cst <= nst2) {
                System.out.print("* ");
                cst++;
            }

            System.out.println();
            nst1--;
            nst2 += 2;
            rows++;

        }

    }
} ```

Thank you sir. now I got it.

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.