My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
C++ Program for probability- 12
Posted Date: 23 Mar 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: ashish singh Member Level: Diamond Rating: Points: 3
|
|
|
|
//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 = "<cout<<"\nprobability in case 2 = "<cout<<"\nprobability in case 3 = "<cout<textcolor(RED); cprintf("but required probability is p1+p2+p3 = %f",p1+p2+p3); getch(); }
output: enter the number of white & black balls for urn 1 10 3 enter the number of white & black balls for urn 2 3 5
case 1 : both ball drawn from urn1 are black
case 2: when both balls drawn from urn 1 are white
case 3 : when one ball is white & other is black probability in case 1 = 0.011538 probability in case 2 = 0.288462 probability in case 3 = 0.153846 but required probability is p1+p2+p3 = 0.453846
Plain Text Attachment [ Scan and Save to Computer ] #include main ( ) { int a = 5; printf("value of a = %d\n",a); printf("address of a = %u\n",&a); }
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|
Watch TV Channels
|