I have written this code specially for row =7, taking 3 cases , want to know what changes i should do

public class Online {

public static void main(String[] args) {
	System.out.println("enter the number of rows");
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int row = 1;
	int nst = (n+1)/2 - 1;
	int nsr = (n+1)/2 - 1;
	int nsp;
	int nsa = (n+1)/2 -1;
	int nss = (n+1)/2 -1;
	int nsn =5;		
	for(row=1;row<=n;row++) {
		if(row<=n/2) {
			int cst = nst ;
			while(cst>0) {
				System.out.print("*");
				cst--;
			}nst--;
			nsp = 2*row - 1;
		int csp = 1;
		while(csp<=nsp) {
			System.out.print(" ");
			csp++;
		}nsp++;
		int csr = nsr;
		while(csr>0) {
			System.out.print("*");
			csr--;}
		nsr--;
		System.out.println();
		}
		else if (row == (n+1)/2) {
			System.out.println();
		}
		else {
			int css  =1;
			while(css<=nss) {
				System.out.print("*");
				css++;
				}
			nss++;
			nsn =nsn -2;
			int csn = nsn;
			while(css>0) {
				System.out.print(" ");
				csn--;
			}nsn--;
			int csa =1;
			while(csa<=nsa) {
				System.out.print("*");
				csa++;
			}nsa++;
			System.out.println();
		}
	}System.out.println();
}

}

hey @rishabh.chhabra10
just change in 3rd case (else part ) and int nsa = (n + 1) / 2;
else {
int css = 1;
while (css <= nss) {
System.out.print("*");
css++;
}

// nsn = nsn - 2;
int csn = nsa;
while (csn >= 0) {
System.out.print(" ");
csn–;
}

			// nsn++;
			int csa = 1;
			while (csa <= nss) {
				
				System.out.print("*");
				csa++;
			}

			nss++;
			nsa -= 2;
			System.out.println();
		}
	}

correct code :