Printing array with no adjacent zeroes [closed]

  arrays, c++, swap

Write a program to shift all the zero present in the array in the alternative order, For example.

Input array: –
1 2 0 8 5 0 0 6

Output array: –
1 0 2 8 0 5 0 6

Sample Input:
First input should describe the number of elements in the array and in the second line take all the input.

5
0 1 2 0 3

Output: –

1 0 2 0 3

Source: Windows Questions C++

LEAVE A COMMENT