In number pattern 24

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++;
	}

Hii Nipun,
You can use row instead of val

Hi Nipun,
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.