
please wait
n
is the variable that holds the number to display. The trick here is that in the first loop, n is not the index of the loop. It's some other variable like i. Each time through the loop you multiple n by 3 and print it out.
for (int i = n; i < 27; i*= 3)
. This way the for loop can use different numbers to generate the same concept.