Hi, I’m not able to write the code to increment & decrement
numbers here. could you help?
Doubt in pattern 33 (practice questions)
int nst = 1;
int nsp = n - 1;
int row = 1;
int num = 9;
while (row <= n) {
int csp = 1;
while (csp <= nsp) {
System.out.print(" ");
csp++;
}
int cst = 1;
while (cst <= nst) {
if (row == 1) {
System.out.print("0");
break;
} else {
if (row == cst) {
System.out.print("0");
} else {
System.out.print(num);
}
cst++;
}
}
System.out.println();
if (cst < row) {
num++;
} else if (cst > row) {
num--;
}
nst += 2;
nsp--;
row++;
}
