Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Simple problem : getting a median
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ford_masta_665




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Thu Feb 10, 2005 5:33 pm   Post subject: (No 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
TheZsterBunny




PostPosted: Sat Feb 12, 2005 8:14 am   Post subject: (No subject)

good lord!

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

please do a search before making a new topic

-Z
endusto




PostPosted: Sun Feb 13, 2005 11:25 am   Post subject: (No 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
ssr




PostPosted: Sun Feb 13, 2005 12:26 pm   Post subject: (No 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
ssr




PostPosted: Sun Feb 13, 2005 12:30 pm   Post subject: (No subject)

I was readin this Laughing
ssr




PostPosted: Sun Feb 13, 2005 12:33 pm   Post subject: (No 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)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: