When the loop runs the first time, ii contains 1 as arr[0] contains the value 1. The loop prints arr[1]=0 (as ii contains the value 1). Then you set arr[ii] to 0 i.e. arr[1] is set to 0.
Then when the loop run's 2nd time, ii contains the value of arr[1] which is 0. The loop prints arr[0]=0 (as ii contains the value 0). Then you set arr[ii] to 0 at this point ii is 0 so you set arr[0] to 0.
Then when the loop run's 3rd time, ii contains the value of arr[2] which is 3. The loop prints arr[3]=0 (as ii contains the value 3). Then you set arr[ii] to 0 at this point ii is 3 so you set arr[3] to 0.
Then when the loop run's 4th time, ii contains the value of arr[3] which is 0. The loop prints arr[0]=0 (as ii contains the value 0). Then you set arr[ii] to 0 at this point ii is 0 so you set arr[0] to 0...