1. i dont understand the use of CSTvariable , i have done the previous code with for loop and without a variable and it is working fine. 2. if i have to do using for loop like last code what alterations i have to make

public static void main(String[] args) {

	System.out.println("enter the value");
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int row = 1;
	int nst = 1;
	for (row = 1; row <= n; row++) {
		for (nst = 1; nst <=row; nst++) {
			System.out.print("*");
		}
		System.out.println();

	}

}

}

hey @rishabh.chhabra10
for (nst = n-row; nst>= 0; nst–) { instead of for (nst = 1; nst <=row; nst++) {
cst variable keep track of count of star

yes but i have done it without using it (cst) and will it be nst–?

Question : but i have done it without using it (cst)
Answer : No issue ,