Computer Science Canada

Find Mean 3 Numbers

Author:  eNc [ Mon Nov 01, 2004 5:22 pm ]
Post subject:  Find Mean 3 Numbers

Hi how do you find the mean of 3 numbers if you can't use if statements, for loops, loops, arrays, basically nothing more advanced than Math.max function.

Author:  Andy [ Mon Nov 01, 2004 7:18 pm ]
Post subject: 

i dont see how any competent programmer can not noe how to do that??? float avg=(num1+num2+num3)/3.0;

Author:  wtd [ Mon Nov 01, 2004 7:51 pm ]
Post subject: 

I think maybe he's talking about "median".

Psuedocode:
code:
max(min(number_1, number2), number_3)

Author:  eNc [ Mon Nov 01, 2004 9:24 pm ]
Post subject: 

omg wtd yea thats wut i meant, ty so much u saved me again!


omg man ure my hero man omg i'm so happy, i have this comp sci test tomrrow and omg i got the scoop on the question and omg! ! ! i was like stuk and u saved me omg ure my hero i'm so happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy 20 bits 2 u Razz

Author:  zylum [ Tue Nov 02, 2004 10:01 pm ]
Post subject: 

wtd wrote:
I think maybe he's talking about "median".

Psuedocode:
code:
max(min(number_1, number2), number_3)


i think you meant

code:
min(max(number_1, number_2), number_3)

Author:  wtd [ Tue Nov 02, 2004 10:27 pm ]
Post subject: 

zylum wrote:
wtd wrote:
I think maybe he's talking about "median".

Psuedocode:
code:
max(min(number_1, number2), number_3)


i think you meant

code:
min(max(number_1, number_2), number_3)


Yes, of course, thank you.

Author:  eNc [ Wed Nov 03, 2004 3:42 pm ]
Post subject: 

wtd wrote:
zylum wrote:
wtd wrote:
I think maybe he's talking about "median".

Psuedocode:
code:
max(min(number_1, number2), number_3)


i think you meant

code:
min(max(number_1, number_2), number_3)


Yes, of course, thank you.



well yea slight error but he meant it the other way Razz i'm not an idiot i understood what he ment.

Author:  wtd [ Wed Nov 03, 2004 3:46 pm ]
Post subject: 

eNc wrote:
i'm not an idiot


But I am! Smile

Author:  eNc [ Wed Nov 03, 2004 7:20 pm ]
Post subject: 

wtd wrote:
eNc wrote:
i'm not an idiot


But I am! Smile



I DISAGREE

Author:  rizzix [ Wed Nov 03, 2004 7:24 pm ]
Post subject: 

haha.. now think about this.. if a person says he's an idiot.. you should never disagree.. by disagreeing you have acknowledge your self more of an idiot than he/she is.. so you should always agree Laughing LOL

Author:  Hikaru79 [ Thu Nov 04, 2004 7:38 am ]
Post subject: 

eNc wrote:
i have this comp sci test tomrrow and omg i got the scoop on the question and omg! ! !


Confused Probably not a good idea to say that aloud. Especially not on a forum that a few teachers lurk around on.

Author:  McKenzie [ Thu Nov 04, 2004 12:42 pm ]
Post subject: 

I hate to extend an already overdone topic ... but
code:
min(max(number_1, number_2), number_3)

???
min(max(5,10),0) is 0
and clearly median is 5. Wink

Author:  bugzpodder [ Thu Nov 04, 2004 1:01 pm ]
Post subject: 

median=a+b+c-(a>=b&&a>=c?aSadb>=a&&b>=c?b:c))-(a<=b&&a<=c?aSadb<=a&&b<=c?b:c));

equilvalently,

median=a+b+c-Math.Max(Math.Max(a,b),c)-Math.Min(Math.Min(b,c),a);

Author:  wtd [ Thu Nov 04, 2004 2:58 pm ]
Post subject: 

McKenzie wrote:
I hate to extend an already overdone topic ... but
code:
min(max(number_1, number_2), number_3)

???
min(max(5,10),0) is 0
and clearly median is 5. Wink


Yes, we covered this. I'm a moron. Smile

Author:  eNc [ Thu Nov 04, 2004 5:51 pm ]
Post subject: 

Hikaru79 wrote:
eNc wrote:
i have this comp sci test tomrrow and omg i got the scoop on the question and omg! ! !


Confused Probably not a good idea to say that aloud. Especially not on a forum that a few teachers lurk around on.


my teach doens' t know about his... yet

Author:  McKenzie [ Thu Nov 04, 2004 8:45 pm ]
Post subject: 

wtd,
Again, I hate to beat a dead horse but the correction was just as wrong as the first code.

Bugz...what are you doing? Didn't you read that he is useing this to cheat on a test?

Author:  rizzix [ Thu Nov 04, 2004 9:08 pm ]
Post subject: 

ah didn't realize that... none of us did.. thread locked Twisted Evil
although it's no point now.. but a locked thread is never a good thing..

WARNING: eNc consider your self warned!


: