code seeps to be correct but when submitted the code it failed please help me with this
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan =new Scanner(System.in);
System.out.println("enter the value");
int N =scan.nextInt();
int nst=N;
int nsp=N;
int row=1;
while(row<=N&&N<=20)
{
if(row==1||row==N)
{
for(int csp=1;csp<=nsp;csp++)
{
System.out.print(" ");
}
for(int cst=1;cst<=nst;cst++)
{
System.out.print("*");
}
}
else
{
for(int csp=1;csp<=nsp;csp++)
{
System.out.print(" ");
}
for(int cst=1;cst<=nst;cst++)
{
if(cst==1||cst==nst)
{
System.out.print("*");
}
else
{
System.out.print(" ");
}
}
}
System.out.println();
row++;
nsp--;
}
}
}