# Sorting user-defined numbers largest to smallest?

**URL:** <https://forum.kirupa.com/t/sorting-user-defined-numbers-largest-to-smallest/41570>\
**Category:** flash\
**Created:** [January 30, 2004, 6:39pm UTC](https://forum.kirupa.com/t/sorting-user-defined-numbers-largest-to-smallest/41570 "2004-01-30T18:39:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RageW0lf](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@RageW0lf](https://forum.kirupa.com/u/RageW0lf)\
**Post date:** [January 30, 2004, 6:39pm UTC](https://forum.kirupa.com/t/sorting-user-defined-numbers-largest-to-smallest/41570/1 "2004-01-30T18:39:32Z")

</div>

Hi,

I am looking for a way to sort numbers enterred by a user, prefferably in order smallest to largest or vice verser - but at very least to find the smallest & largest numbers of the ones enterred.

There are approximately going to be 15 numbers or so.

So for example:

* * *

Enterred A = 56  
Enterred B = 7  
…  
…  
Enterred H = 72

* * *

then it should display:

* * *

Enterred B = 7  
…  
…  
Enterred A = 56  
…  
…  
Enterred H = 72

* * *

when sorted or the other way round (largest to smallest).

this could be done with comparrisons but for 15 numbers it would be A LOT of comparisons.

Does anybody know an algorithm or a way of doing this more simply ?

Array.sort may do it but not sure if it works for numbers?

Any help is much appreciated!
