+ 2

Hi, Could You explpain me, why $res=6 in the END is the result of the code below?

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

1st Jul 2019, 12:39 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
4 Réponses
+ 2
a start with 3 that means for each push r[0]=3 r[1]=4 r[2]=5 r[3]=6
1st Jul 2019, 12:41 PM
Taste
Taste - avatar
+ 2
Thank You, Teste. That'sright
1st Jul 2019, 12:46 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 2
Thanks You too, Prokopios!!!
1st Jul 2019, 12:49 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
+ 1
Loop Iteration -- =========== 1 : $i = 3 ; $res[0] = 3 2 : $i = 4 ; $res[1] = 4 3 : $i = 5 ; $res[2] = 5 4 : $i = 6 ; $res[3] = 6 5 : $i = 7 ; $res[4] = 7 6 : $i = 8 ; $res[5] = 8 7 : $i = 9 ; $res[6] = 9 As a result, $res[3] = 6
1st Jul 2019, 12:45 PM
Prokopios Poulimenos
Prokopios Poulimenos - avatar