If i give any number, the output's rows are less than that number. Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If i give any number, the output's rows are less than that number. Why?

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

28th Mar 2021, 5:47 AM
Jawahirullah
Jawahirullah - avatar
5 Answers
+ 1
It's because you increment i on line 18, which you don't need to do as i as incremented automatically as set by the for loop (line 8). This means that you're incremented i twice for each loop, so you get fewer lines than you are expecting.
28th Mar 2021, 8:40 AM
Russ
Russ - avatar
+ 1
The amount of rows depends on the input. So I need to know what did you input to get the 5 rows.
28th Mar 2021, 6:36 AM
Seb TheS
Seb TheS - avatar
+ 1
M. Jawahirullah are you trying to make a Floyd triangle?
28th Mar 2021, 7:36 AM
Atul [Inactive]
+ 1
Thank u Russ
28th Mar 2021, 8:42 AM
Jawahirullah
Jawahirullah - avatar
0
No problem! Happy coding!
28th Mar 2021, 8:43 AM
Russ
Russ - avatar