#include
#include
#include
#include
#define max 5
void main()
{
textcolor(LIGHTGREEN);
clrscr();
float urn[max],w[max],b[max],p[max],sum=0;
int num,nw;
cout<<"enter the number of urns : ";
cin>>num;
cout<<"enter the number of white balls to be drawn :";
cin>>nw;
for(int i=0;i
{
cout<<"for urn "<<<" enter its probability : ";
cin>>urn[i];
cout<<"\n enter the number of white & black balls resp. : ";
cin>>w[i]>>b[i];
p[i]=nCr(w[i],nw)/nCr(w[i]+b[i],nw);
sum+=p[i]*urn[i];
}
cout<<"\nthe required probability 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 number of urns : 3
enter the number of white balls to be drawn :2
for urn 1 enter its probability : 0.2
enter the number of white & black balls resp. : 7 3
for urn 2 enter its probability : 0.6
enter the number of white & black balls resp. : 4 6
for urn 3 enter its probability : 0.2
enter the number of white & black balls resp. : 2 8
the required probability is 0.177778
No comments:
Post a Comment