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

//program no. 10 (probability)

#include
#include
#include
#define max 5
void main()
{
float num,a[max],s[max],p[max],sum=0;
textcolor(LIGHTGREEN); int m;
clrscr();
cout<<"enter the number of plants = ";
cin>>num;
cout<<"enter the plant which scooter is likely to be found ";
cin>>m;
for(int i=1;i<=num;i++)
{
cout<<"enter the % of sccoters manufactured at plant "<<<" = ";
cin>>a[i];
cout<<"enter the % of scooters of standard quality manufactured at
plant "<<<" = ";
cin>>s[i];
sum+=a[i]*s[i];
}
p[m]=a[m]*s[m]/sum;
cout<<"\nthe chance that it comes from plant "<<<" = "<
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 plants = 2
enter the plant which scooter is likely to be found 2
enter the % of sccoters manufactured at plant 1 = 0.7
enter the % of scooters of standard quality manufactured at plant 1 =
0.8
enter the % of sccoters manufactured at plant 2 = 0.3
enter the % of scooters of standard quality manufactured at plant 2 =
0.9

the chance that it comes from plant 2 = 0.325301

No comments:

Post a Comment