posted 15 years ago
your code executes this way:
first iteration:
i = 1, x[1] = 0, array becomes: x = (1, 0 , 3, 4)
second iteration:
i = 0, x[0] = 0, array becomes: x = (0, 0, 3, 4)
third iteration:
i = 3, x[3] = 0, array becomes: x = (0, 0, 3, 0)
fourth iteration:
i = 0, x[0] = 0, array becomes: x = (0, 0, 3, 0)
final answer: x = (0, 0, 3, 0)