Hi It seems like bubble sort example but the condition is little different.Try bellow code
int[] a = new int[] { 5, 0, 1, 4, 3, 0, 0, 6, 1, 0 };
int temp;
for (int pass = 1; pass <= a.Length - 2; pass++)
{
for (int i = 0; i <= a.Length - 2; i++)
{
if (a[i]==0 )
{
temp = a[i + 1];
a[i + 1] = a[i];
a[i] = temp;
}
}
}
string str = "";
for (int i = 0; i < a.Length; i++) //for loop to print sorted elements
{
str += a[i] + ",";
}
in str you can able to find the sorted list of aaray.