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

//program no.8 (probability)
#include
#include
#include
#include
#include
void main()
{
textcolor(LIGHTBLUE);
clrscr();
int d,t,p1,p2,p3,p4,n;
cout<<"enter the number of total bulbs = ";
cin>>t;
cout<<"enter the number of defected bulbs = ";
cin>>d;
cout<<"the number of bulbs drawn = ";
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"\n\nCASE "<<<" : WHEN "<<<" DEFECTED BULB AND "<<<" GOOD
BULBS ";
cout<<"\nthe probability = "<
}
delay(5000);
textcolor(GREEN);
clrscr();
cout<<"\nthe probability distribution table ";
cout<<"\n\n";
cout<<"number\t";
cout<<"probability\n";
for(i=1;i<=n;i++)
{cout<
cout<<
cout<<"\n";
}
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 total bulbs = 20
enter the number of defected bulbs = 5
the number of bulbs drawn = 4


CASE 1 : WHEN 1 DEFECTED BULB AND 3 GOOD BULBS
the probability = 0.462332

CASE 2 : WHEN 2 DEFECTED BULB AND 2 GOOD BULBS
the probability = 0.693498

CASE 3 : WHEN 3 DEFECTED BULB AND 1 GOOD BULBS
the probability = 0.462332

CASE 4 : WHEN 4 DEFECTED BULB AND 0 GOOD BULBS
the probability = 0.115583

the probability distribution table

number probability
1 0.462332
2 0.693498
3 0.462332
4 0.115583

No comments:

Post a Comment