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 no. probability-5

//Program no. 5 (probability)

#include
#include
#include
#include
void main()
{
textcolor(GREEN);
clrscr();
int a,b,p1,b1,p2,b2; double s1,s2;
cout<<"enter the num. of share of A in the lottery : ";
cin>>a;
cout<<"enter the num. of prizes and blanks :";
cin>>p1>>b1;
cout<<"enter the num. of share of B in the lottery : ";
cin>>b;
cout<<"enter the num. of prizes and blanks :";
cin>>p2>>b2;
s1=((nCr(p1,a))+((nCr(p1,1))*(nCr(b1,1))))/nCr((p1+b1),a);
cout<<"\n\n\athe probability of success of A is : "<
s2=(nCr(p2,3)+nCr(p2,2)*nCr(b2,1)+nCr(p2,1)*nCr(b2,2))/nCr((p2+b2),b);
cout<<"\n\n\athe probability of success of B is : "<
cout<<"\n\n\athe ratio of success of A:B 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 num. of share of A in the lottery : 2
enter the num. of prizes and blanks :3 5
enter the num. of share of B in the lottery : 3
enter the num. of prizes and blanks :4 6

the probability of success of A is : 0.642857

the probability of success of B is : 0.833333

the ratio of success of A:B is 0.771429

No comments:

Post a Comment