Consider the sort function.
In reply to Re: Sorting of numbers using arrays by Anonymous Monk in thread Sorting of numbers using arrays by suneeldv