Probability of 2 balls

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
Well if you're a man I would say the probability of two balls is 100%
What if you're a black man? Getting two white balls is quite unlikely.


@OP: Do you know the formula on paper?
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!
Topic archived. No new replies allowed.