why is my code not working when I try with a[i] ,and it’s giving correct answer when I store a[i] in variable e.
code link: https://ide.codingblocks.com/s/469361
why is my code not working when I try with a[i] ,and it’s giving correct answer when I store a[i] in variable e.
code link: https://ide.codingblocks.com/s/469361
a[j+1] = a[i];
if you do this your code will fail because you see you are updating the values of array in the same loop so when you update a[j+1] with this value it ll put the updated value not the original one .so assign the value to e and then use it