CJCoding With Joseph

Move Zeros to End

Given the array {0, 1, 0, 3, 12}, move every 0 to the end while keeping the order of the non-zero elements, then print the array on one line separated by spaces:

1 3 12 0 0

Expected Output:

1 3 12 0 0
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.