// TODO Auto-generated method stub
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int row = 1;
int nsp = n - 1;
while(row <= n) {
for(int i=1; i<=nsp; i++) {
System.out.print(" ");
}
if(row == 1 || row == n) {
while(n-- > 0) {
System.out.print("*");
}
} else {
for(int i=1; i<= n; i++) {
if(i==1 || i==n ) {
System.out.print("*");
}else {
System.out.print(" ");
}
}
}
System.out.println();
nsp--;
row++;
}
Why is this else part not getting covered?