Computer Science Canada

Simple problem : getting a median

Author:  ford_masta_665 [ Thu Feb 10, 2005 5:10 pm ]
Post subject:  Simple problem : getting a median

I know this is tupid, but could somebody please remind me how to make a program where the user inputs a bunch of #s and the comp outputs the median of those #s? thanx

Author:  Cervantes [ Thu Feb 10, 2005 5:33 pm ]
Post subject: 

It will probably involve sorting an array of numbers then using the middle element of that array as your median.
If you don't know how to sort an array, try to work out your own method. Smile

P.S. Welcome to the site Smile

Author:  TheZsterBunny [ Sat Feb 12, 2005 8:14 am ]
Post subject: 

good lord!

I posted an answer to this question barely a week ago!

please do a search before making a new topic

-Z

Author:  endusto [ Sun Feb 13, 2005 11:25 am ]
Post subject: 

try this
code:

var med1, med2, med3, med4:int
put "Enter four numbers"
get med1
get med2
get med3
get med4
put (med1 + med2 + med3 + med4) / 4

Author:  ssr [ Sun Feb 13, 2005 12:26 pm ]
Post subject: 

endusto wrote:
try this
code:

var med1, med2, med3, med4:int
put "Enter four numbers"
get med1
get med2
get med3
get med4
put (med1 + med2 + med3 + med4) / 4


*** I think he said
Quote:
the median

not the mean Laughing

Author:  ssr [ Sun Feb 13, 2005 12:30 pm ]
Post subject: 

I was readin this Laughing
http://www.compsci.ca/v2/viewtopic.php?t=6724&highlight=median

Author:  ssr [ Sun Feb 13, 2005 12:33 pm ]
Post subject: 

btw, that one was mostly for finding the mode, its harder.
But median is basically just find the middle #, if even then add up the middle 2 and divide them by 2
That ow I learnt it anywayz 8) 8)


: