def rearrangeFunc(array, n) :
j = -1
for i in range(0, n) :
if (array[i] % 2 == 0) :
j = j + 1
temp = array[i]
array[i] = array[j]
array[j] = temp
array = [ 12, 11, 1, 45, 17, 1, 10, 45, 14, 25, 8 ]
n = len(array)
rearrangeFunc(array, n)
for i in range(0,n) :
print( array[i] ,end= " ")
12 10 14 8 17 1 11 45 1 25 45
Comments
Leave a comment