not able to write he right code…tell me the right code
package praticesec1;
import java.util.Scanner;
public class Pro20 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int nsp = n/2;
int nsp2 = 1;
for(int row =1;row<=n;row++)
{
// work for space
for(int csp=1;csp<=nsp;csp++)
{
System.out.print(" ");
}
// work for star
System.out.print("* “);
// work for space and star
if(row != 1 || row !=n)
{
for(int csp =1;csp<=nsp2;csp++ )
{
System.out.print(” “);
}
System.out.print(”* " );
}
// preparation
System.out.println();
if(row<=n/2)
{
nsp–;
nsp2 +=2;
}
else
{
nsp++;
nsp2 -=2;
}
}
}
}