+ 1
30th May 2022, 11:02 AM
🕸carpe diem🕸
🕸carpe diem🕸 - avatar
2 Respostas
+ 3
When i is 0 x[0] = x[0+1] =x[1] =3 so first element becomes 3 Then, when i is 1, x[1] = x[1+1] =x[2] =2 so second element becomes 2 Similarly, when i is 2, x[2] = x[2+1] =x[3] =5 so third element becomes 5 condition is i < length - 1 length is 4 length - 1 is 3 so max is 2 so for loop ends so fourth element remains unchanged
30th May 2022, 11:39 AM
Gordon
Gordon - avatar
+ 2
Thanks a lot. I understand now.
30th May 2022, 1:53 PM
🕸carpe diem🕸
🕸carpe diem🕸 - avatar