Problem Statement
Write a C program to move all zeros in a 1D array to the end while maintaining the relative order of the non-zero elements.
Example
Input:
5 0 1 0 3 12
Output:
1 3 12 0 0
DEMO-C-32 โข Programming in C
Write a C program to move all zeros in a 1D array to the end while maintaining the relative order of the non-zero elements.
Input:
5 0 1 0 3 12
Output:
1 3 12 0 0
n and array
Array with zeros at end
Submit runs every public testcase in this browser. Results and code never leave this device.
5 0 1 0 3 12
1 3 12 0 0
3 0 0 0
0 0 0
C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.
/workspace/question