Program to shift all zero to the end of array in Golang
The task is to shift all the zeroes appearing in the array to the end of the array. In Golang, this can be done as follows:
Input: 1 0 7 0 3 Output: 1 7 3 0 0
The array elements after shifting all zero to ends: 1 7 3 0 0
Explanation: The logic behind the above example is that the user inputs the number of elements and the values of those elements. Then, the array is traversed while searching the zeroes and the zeroes are then shifted to the end of the array.