Scanner sc= new Scanner(System.in);
System.out.println(“ENTER VALUE OF N”);
int n= sc.nextInt();
int nr= 2n-1;
int nst= 1;
int row=1;
while(row<=nr) {
//work
int cst=1;
while(cst<=nst) {
System.out.println("");
cst++;
}
//preparation
System.out.println();
if (row<=nr/2)
{
nst=nst+1;}
else {
nst=nst-1;
}
row=row+1;
}
}
}