can we don’t use VAL variable and use Row variable as the number printing variable
my code:
Scanner s = new Scanner(System.in);
int n = s.nextInt();
// row
int row = 1;
// Ques 24:
// n = 5
// - - - - 1
// - - - 2 2 2
// - - 3 3 3 3 3
// - 4 4 4 4 4 4 4
// 5 5 5 5 5 5 5 5 5
// work
int nst = row;
int nsp = n - 1;
while (row <= n) {
//space work
int csp = 1;
while (csp <= nsp) {
System.out.print("- ");
csp++;
}
//number work
int cst = 1;
while (cst <= nst) {
System.out.print(row + " ");
cst++;
}
// preparation
nsp--;
nst = nst + 2;
System.out.println();
row++;
}