Don't know what's wrong with the code. It looks fine to me. I read about array and bubble sort on an another website and tried to implement it. But the code didn't ran as expected.