Feb 26, 2012 at 11:14pm UTC
I got two boxes each contains 1 white ball n 1 red ball...what is the probability of I'm getting 2 white balls ? Can you help me to program this in C++ ?
result :
Boxes : 2
Chances : 1 out of 4
W R
W W
R R
R W
Feb 27, 2012 at 4:53pm UTC
Well if you're a man I would say the probability of two balls is 100%
Feb 27, 2012 at 4:56pm UTC
What if you're a black man? Getting two white balls is quite unlikely.
@OP: Do you know the formula on paper?
Feb 27, 2012 at 7:20pm UTC
Sorry I don't get the connection of the obove with C++ here.
This is probability theory problem.
The answer is that for equal probability balls retriving a color is 50%. So you have 50% to retrieve 1 white.
Second box is considered independent so it also has 50% for a white ball.
So total probability for 2 white is 0.5*0.5 = 0.25 or 25%
No C++ needed here though!