int cst = 1;
if (row == n + 1) {
cst = 2;
val += 2;
} else {
cst = 1;
val++;
}
// work for numbers
for (; cst <= nst; cst++) {
System.out.print(val + " ");
val++;
}
int cst = 1;
if (row == n + 1) {
cst = 2;
val += 2;
} else {
cst = 1;
val++;
}
// work for numbers
for (; cst <= nst; cst++) {
System.out.print(val + " ");
val++;
}
Give me the full code for this which is runnable on the ide