Note.....

Dear readers I Have collected these Programs from various sources of internet...I don't know what the header file is Please mail me if any error found hi2rashid@yahoo.co.in

Sponsored....

Tuesday, April 13, 2010

C++ Program for probability- 12

//program no. 12 (probability)

#include
#include
#include
#include
void main()
{
textcolor(BROWN);
clrscr();
int w1,w2,b1,b2;
float p1,p2,p3;
cout<<"enter the number of white & black balls for urn 1 "; cin>>w1>>b1;
cout<<"enter the number of white & black balls for urn 2 "; cin>>w2>>b2;
cout<<"\ncase 1 : both ball drawn from urn1 are black "; p1=(nCr(b1,2)/nCr(b1+w1,2))*(nCr(w2,1)/nCr(w2+b2+2,1)); cout<<"\n\ncase 2: when both balls drawn from urn 1 are white"; p2=(nCr(w1,2)/nCr(w1+b1,2))*(nCr(w2+2,1)/nCr(w2+b2+2,1)); cout<<"\n\ncase 3 : when one ball is white & other is black"; p3=((nCr(w1,1)*nCr(b1,1))/nCr(w1+b1,2))*(nCr(w2+1,1)/nCr(w2+b2+2,1)); cout<<"\nprobability in case 1 = "< 2 = "< cout<<" 3 = "< cout< textcolor(RED); cprintf(" p3 =" %f" 1 =" 0.011538" 2 =" 0.288462" 3 =" 0.153846" p3 =" 0.453846">
main ( )
{
int a = 5;
printf("value of a = %d\n",a);
printf("address of a = %u\n",&a);
}

No comments:

Post a Comment