Given an array of elements consisting of 0, 1, 2, the task is to sort the array.The approach is to count the number of 0s, 1s, and 2s in the array and then place those many 0s, 1s, and 2s in the array.The implementation is done in C using a counting approach.The sorted array is printed as the output.