array sorting using for loop
select