Why to use extra variable?

public static void triangleEqualRN(int n){
int i=1;
while(i<=n){
int j=1;
while(j<=i){
System.out.print("* ");
j++;
}
System.out.println();
i++;
}
}

@nikhar_ae513f1ea7b43118 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.