+ 3

What are some few helpful tips on loops?

Are there general helpful tips that someone can share on loops(Any language is okay since their functioning is similar). I already know how they work in general but still struggle with them in some areas. I noted this because I fail almost every loop related question on challenges. I'd appreciate a sort of simplified guide on how to look at loops in different perspectives.

18th Nov 2017, 6:32 AM
Nick Nderitu
Nick Nderitu - avatar
4 Answers
+ 4
the most common loop questions on sololearn are loops nested in other loops!I don think any course explains those. int a=0; for(int I=0;I<7;I++) { for(int v=0;v<5;v++) { a++;} } To calculate how the work just do the number of times the outermost loop runs multiplied with the number of times the innermost loop runs I.e 7×5=35! so you can guess a=35; hope I helped
18th Nov 2017, 7:12 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
:0
20th Nov 2017, 3:02 AM
Hugo Castillo
Hugo Castillo - avatar
0
I did a lot of research and came up with something https://code.sololearn.com/WJmHP9Lq9A5V/#html
11th Jan 2018, 9:56 AM
Nick Nderitu
Nick Nderitu - avatar