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- 4

//Program no. 4 (probability)

#include
#include
#include
void main()
{
textcolor(GREEN);
clrscr();
float a1,a2,b1,b2,c1,c2,p1,p2;
cout<<"enter the success ratio of A in the form (x,y) : "; cin>>a1>>a2;
cout<<"enter the success ratio of B in the form (x,y) : "; cin>>b1>>b2;
cout<<"enter the success ratio of C in the form (x,y) : "; cin>>c1>>c2;
cout<<"\n\awhen any two hit the shot "; p1=((a1/a2)*(b1/b2)*((c2-c1)/(c2)))+(((a2-a1)/a2)*(b1/b2)*(c1/(c2)))+((a1/a2)*((b2-b1)/b2)*(c1/c2)); cout<<"\n\nthe probability in this case is "< p2="((a1/a2)*(b1/b2)*(c1/c2));">
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 success ratio of A in the form (x,y) : 4 5
enter the success ratio of B in the form (x,y) : 3 4
enter the success ratio of C in the form (x,y) : 2 3

when any two hit the shot
the probability in this case is 0.433333

when all three review the book
the probability in this case is 0.4

the required probability is 0.833333

No comments:

Post a Comment