I write this code the problem comes in the third row it will print two stars continually …am not able to get over it
package praticesec1;
import java.util.Scanner;
public class Pro8 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int nspi= 1;
int nspo = n-2;
for(int row =1;row<=n;row++)
{
// work for space
for(int csp1 =1;csp1<nspi;csp1++)
{
System.out.print(" “);
}
// work for star
System.out.print(”* “);
// work for spaces
for(int csp2 =1;csp2<=nspo;csp2++)
{
System.out.print(” “);
}
// work for star
System.out.print(”* “);
// work for spaces
for(int csp1 =1;csp1<nspi;csp1++)
{
System.out.print(” ");
}
// preparation
System.out.println();
if(row <(n+1)/2)
{
nspi++;
nspo -=2;
}else
{
nspi–;
nspo +=2;
}
}
}
}