The output of the code below work proper till input 8 but after the spaces is not propper , how to solve that?
Scanner scn = new Scanner(System.in);
int row =1;
int n = scn.nextInt();
int s =0;
int x=1;
int y=1;
while(row<=(n-1)){
int counter =1;
if (n==1) {
System.out.println(“0”);
}
if(n>1&row==1) {
System.out.println("0");
System.out.print("1"+"\t");}
while(counter<=y) {
int sum =s+x;
s=x;
x=sum;
System.out.print(sum+"\t");
counter=counter+1;
} System.out.println();
if (row==1) {
y=y+2;
}
else {
y=y+1;
}row = row+1;
}