View Single Post
  #3 (permalink)  
Old October 16th, 2004, 12:05 PM
mehdi62b mehdi62b is offline
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

ohh,sorry,I was just thinking I'm taking mathematics exam!!!
I forgot we have a computer and can use it!!!
Code:
a special syntax!!!
int sum:=0;
int pre=:PreviousStep;
For Dice1:=1 to 10
 For Dice2:=1 to 10
  For Dice3:=1 to 10
     if(dice1!=dice2!=dice3) & (dice1+dice2+dice3>=Pre)  then sum:=sum+1;
//sum is the naswer
now the probability is n(A)/n(S);
n(S)=10*9*8
n(A)=sum
so p(A)=n(A)/n(S)=sum/10*9*8.

--------------------------------------------
Mehdi.:)
Reply With Quote