Int pattern 21, i did not understand the last row concept and also coding

i did not understand the last row conditions
int cst = 1;
if(row==n){
cst=2;
}

Hi Nipun

This condition is used in order to avoid the printing of an extra star in the last row. When we are in the last row, we simply assign cst = 2, so that the loop runs one time less compared to the previous iterations.

Hey 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.