0
Please anybody explain this loop
Explain inner working of code. I am confused little bit. how it's Will give output 12. https://code.sololearn.com/cc8bOEP7CaZX/?ref=app
3 Antworten
+ 4
yes, we can, since we've declared and defined (assigned zero to) the variable i before
+ 2
Tracing
i=0
i<5? //0<5 True
i = i*i //0*0=0
i+=3 //0+3=3
i<5? //3<5 True
i=i*i //3*3=9
i+=3//9+3=12
i<5? //12<5 FALSE, so for loop is over go on next
cout<<i //prints 12
I can't really see practical point in using this kind of loops apart from using it in challenges
0
we can use for loop like this for(;I(5;I++). Because i was study right way of for loop is for(I=0;I<5;I++).