BBS: Inland Empire Archive Date: 08-13-92 (14:35) Number: 165 From: RICK PEDLEY Refer#: NONE To: STEVE CRAVER Recvd: NO Subj: Fomula Conf: (2) Quik_Bas

On 08-13-92 Steve Craver wrote to All... SC> Does anyone know the correct formula for finding the MEDIAN SC> of an array of numbers? Not the average, just the median. Assuming the numbers are in an array, first sort the numbers by whatever method you wish. Then divide the number of elements by 2 and round up; that element lies in the middle. For example, if the number of elements is 13, thenDEFINTA-Z Els = 13IFElsAND1THEN'Tests to see if Els is oddMedian! = N(Els\2 + 1)'The value right in the middleELSEMedian! = (N(Els\2) + N(Els\2 + 1))/2ENDIFThe middle value in the sorted list is the median. If Els is even, there is no middle value, so the two values on either side of the halfway point are averaged.\ ... OFFLINE 1.40 --- Maximus 2.01wb * Origin: The BULLpen BBS * Intel 14.4EX (613)549-5168 (1:249/140)

Echo Basic Postings

**Books at Amazon:**

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET