|
|
|
Program no. 3 (probability)
#include #include #include void main() { textcolor(GREEN); clrscr(); float a1,a2,b1,b2,c1,c2;float p1,p2; cout<<"enter the odds for 1st critic in the form (x y) : "; cin>>a1>>a2; cout<<"enter the odds for 2nd critic in the form (x y) : "; cin>>b1>>b2; cout<<"enter the odds for 3rd critic in the form (x y) : "; cin>>c1>>c2; cout<<"\ncase 1: when all three review the book "; p1=((a1/(a1+a2))*(b1/(b1+b2))*(c1/(c1+c2))); cout<<"\n\aa\nthe probability in this case is "<cout<<"\n\n\acase 2: when any two review the book "; p2=((a1/(a1+a2))*(b1/(b1+b2))*(c2/(c1+c2)))+((a2/(a1+a2))*(b1/(b1+b2))*(c1/(c1+c2)))+((a1/(a1+a2))*(b2/(b1+b2))*(c1/(c1+c2))); cout<<"\nthe probability in this case is "<cout<<"\n\a\nbut required probability is sum of two probabilities that is "<delay(100); textcolor(RED); cout<<"\n\n\a"; cprintf("PROGRAM DESIGNED BY:ASHISH KUMAR"); cout<<"\n\n"; cprintf("/ roll 249/06 "); getch(); }
output: enter the odds for 1st critic in the form (x y) : 5 2 enter the odds for 2nd critic in the form (x y) : 4 3 enter the odds for 3rd critic in the form (x y) : 3 4
case 1: when all three review the book the probability in this case is 0.174927
case 2: when any two review the book the probability in this case is 0.434402
but required probability is sum of two probabilities that is 0.609329
|
No responses found. Be the first to respond and make money from revenue sharing program.
|