Skip to content
Advertisement

nested for loops inverted half pyramid

for a school project, I am trying to make an inverted half pyramid

my code is currently this

JavaScript

with this output:

JavaScript

desired output:

JavaScript

Advertisement

Answer

Update (based on the updated requirement):

You need a loop to print the = equal to (rowsrow number) times.

JavaScript

Output:

JavaScript

Original answer:

Your inner loop should be

JavaScript

i.e. for each row, it should start with the row number (i.e. i) and go down up to 1.

Advertisement