Testcase #1 wrong answer

the code is giving the perfect pattern but while submitting its showing wrong answer
code is

//	System.out.println("enter");
	Scanner scn = new Scanner(System.in);
	int n= scn.nextInt();
	
		int row=1,nsp=n,nst=1;
		while(row <= n) {
			for(int csp =1;csp<=nsp;csp++) {
				System.out.print(" ");
			}
			for(int cst=1;cst<=nst;cst++) {
				System.out.print("*");
			}
			for(int i =1;i<=3;i++) {
				if(row==1||row==n) {
					System.out.print("*");
				}
				else {
					System.out.print(" ");
				}
			}
			for(int cst=1;cst<=nst;cst++) {
				System.out.print("*");
			}
			System.out.println();
			nsp= nsp-1;
			
			row = row +1;
		}

Hi @vaibhavgupta.1919

For n = 10,
there should be ten values in the first and the last row whereas your code always keeps it 5. Modify the code accordingly.

Hi @vaibhavgupta.1919
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.

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.