Pattern inverted hour glass

my code is running successfully but when i click on submit button it shows error that the test cases fails
here’s my code

import java.util.Scanner;

public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

System.out.println("Enter the number of rows: ");
int n = sc.nextInt();
int nsp = 2 *n - 1;

int nr = 2 *n + 1;
int num = n;
int a = 0;

for (int i = 1; i <= nr; i++)
{
  if (i > n + 1)
    a = nr - i + 1;
  else
    a = i;

  //numbers
  for (int cst = 1; cst <= a; cst++)
  {
    System.out.print(num);
    num--;
  }

  //Spaces
  for (int csp = 1; csp <= nsp; csp++)
  {
    System.out.print(" ");
  }

  for (int cst = 1; cst <= a; cst++)
  {
    num++;
    if (num != 0)
      System.out.print(num);
  }

  if (i <= (nr) / 2)
    nsp -= 2;
  else
    nsp += 2;

  System.out.println();
}

}
}

@tiwari15vishnu_025f0691ba9beb0e remove line :
System.out.println("Enter the number of rows: ");
bcoz your output should be exactly same as given sample output.