Query

i can’t see my submission code.

@discobot

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

        int n = scn.nextInt();
        PattenG(n);
    }

    public static void PattenG(int n) {

        int nsp = n / 2 - 1;
        int rows = 1;
        int nst = n / 2;

        while (rows <= n) {

            if (rows <= n / 2 + 1) {

                if (rows <= n / 2) {
                    System.out.print("*");

                    int csp = 1;
                    while (csp <= nsp) {
                        System.out.print(" ");
                        csp++;
                    }
                } else {
                    int cst = 1;
                    while (cst <= nst) {
                        System.out.print("*");
                        cst++;
                    }
                }

                if (rows == 1 || rows == n / 2 + 1) {

                    int cst = 0;
                    while (cst <= nst) {
                        System.out.print("*");
                        cst++;
                    }
                } else {
                    System.out.print("*");
                }
            } else {

                if (rows < n) {
                    int csp = 0;
                    while (csp <= nsp) {
                        System.out.print(" ");
                        csp++;
                    }
                } else {
                    int cst = 1;
                    while (cst <= nst) {
                        System.out.print("*");
                        cst++;
                    }
                }

                System.out.print("*");

                int csp = 1;
                while (csp <= nsp) {
                    System.out.print(" ");
                    csp++;
                }

                System.out.print("*");

            }
            System.out.println();
            rows++;
        }
    }
}

Hi! To find out what I can do, say @discobot display help.

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.