#include
#include
#include
#define max 5
void main()
{
textcolor(LIGHTBLUE);
clrscr();
int num;
float b[max],d[max],pdb[max],sum=0;
cout<<"enter the number of machines ";
cin>>num;
for(int i=0;i
{
cout<<"enter the percentage of bolts made by machine "<<<" = ";
cin>>b[i];
cout<<"enter the percentage of defective bolts made by machine
"<<<" = ";
cin>>d[i];
pdb[i]=b[i]*d[i];
sum+=pdb[i];
}
for(i=0;i
{
float p1;
p1=b[i]*d[i]/sum;
cout<<"\nthe probability that defective bolt was made by machine
"<<<" = "<
}
delay(800);
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 machines 3
enter the percentage of bolts made by machine 1 = 0.25
enter the percentage of defective bolts made by machine 1 = 0.05
enter the percentage of bolts made by machine 2 = 0.35
enter the percentage of defective bolts made by machine 2 = 0.03
enter the percentage of bolts made by machine 3 = .40
enter the percentage of defective bolts made by machine 3 = 0.02
the probability that defective bolt was made by machine 1 = 0.403226
the probability that defective bolt was made by machine 2 = 0.33871
the probability that defective bolt was made by machine 3 = 0.258065
No comments:
Post a Comment