0

This is an answer provided in our book for this program: 6 5 5 4 4 4 3 3 3 3 2 2 2 2 2 1 1 1 1 1 1. Result is different. Help.

https://code.sololearn.com/WIP1yy85aZom/?ref=app

23rd Aug 2017, 3:59 PM
Wriju Banerjee
Wriju Banerjee - avatar
2 Réponses
+ 13
Do j >=i instead of 1 for (i=6;i>=1;i--) { for (j=6;j>=i;j--) document.write(""+i) document.write("<br>") }
23rd Aug 2017, 4:07 PM
Frost
Frost - avatar
+ 1
for (i=6;i>=1;i--) { for (j=6;j>=i;j--) document.write(""+i) document.write("<br>") } try this, should work... a simple mistake, a number 1 instead of an "i" in second for loop :)
23rd Aug 2017, 4:07 PM
Luca
Luca - avatar