public static void triangleEqualReverseRN(int n) {
int rows = 1;
while (rows <= n) {
int col = 0;
while (col <= n - rows) {
System.out.print("* ");
col++;
}
System.out.println();
rows++;
}
}
Why to use extra space / variable?
@nikhar_ae513f1ea7b43118 Re : Logic of the code varies from person to person. So if you’re able to get the answer by using fewer variables then it’s a good thing and you don’t need to use that extra variable.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.